Currently working for a company that use .NET (not Core) but want to switch to .NET Core and thought to do so by creating an app with a Flutter.io frontend and .NET Core backend
ServiceStack v5.1 has added native support for Dart and Flutter where you can can generate an end-to-end Typed API from a remote URL, e.g:
$ npm install -g @servicestack/cli
$ dart-ref https://www.techstacks.io
This is supported for .NET Core 2.0 as well as any of .NET's popular hosting options. The example above generates a Typed API for the .NET Core 2.0 TechStacks project.
The HelloFlutter App shows an example of calling a .NET Core 2.0 and a classic ASP.NET App back-end using a Typed API:
To call any Service you just need to import the servicestack Dart package and the generated DTOs, e.g:
import 'package:servicestack/client.dart';
import 'techstacks.dtos.dart';
Then create an instance of JsonServiceClient
configured with your remote URL, e.g:
var client = new JsonServiceClient("https://www.techstacks.io");
Which you can then call within your Flutter widget like any async API:
class HelloFlutter extends StatefulWidget {
@override
State createState() => new HelloFlutterState();
}
class HelloFlutterState extends State {
//State for this widget
String result = "";
@override
Widget build(BuildContext context) {
//...
new RaisedButton(
child: new Text("Async"),
onPressed: () async {
var r = await client .get(new Hello(name: "Async"));
setState(() {
result = r.result;
});
},
),
//...
new Text(result),
}
}
For more info see docs for ServiceStack's native Dart support.