Combining Flutter frontend with .NET Core backend for Android and iOS

.NET/core is for API, flutter is for native apps. They are completely unrelated.

One side will have no impact on the other one. So yes, you can use both.


I love using Flutter with my .Net Web Api back ends. The web api support in Flutter is great as they have built in JSON serialization support. the combination is beautiful and I am hooked on this powerful framework


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:

Hello Flutter App

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<StatefulWidget> createState() => new HelloFlutterState();
}

class HelloFlutterState extends State<HelloFlutter> {
  //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.