This video starts from scratch, walking through installing Flutter SDK,
before adding a new native Flutter App to a new .NET Blazor Server project -
giving our existing TODO Blazor Web App new native iOS & Android native UIs
Next, we'll demonstrate the iterative development workflow of making changes
to backend .NET APIs that's easily kept in-sync with our clients Dart DTOs
from within Android Studio or command-line
In this video, we'll show how we can rapidly develop a new Flutter Android Bookings App
added to a new blazor .NET Project using x mix flutter
Next, we'll dive into the development process, where we'll demonstrate the productivity
of calling typed .NET APIs using typed Dart DTOs for end-to-end typed integrations
that can be effortlessly updated from within Android Studio
In this video we should how you can quickly get up and running using ServiceStack's
Dart client library with your Flutter Android or iOS Apps
to generate native typed Dart DTOs with Add ServiceStack Reference
enabling end-to-end typed integrations to call .NET APIs from Flutter Mobile, Desktop and Dart Web Apps
Dart and Flutter gRPC
ServiceStack gRPC is an alternative approach for enabling high-performance end-to-end typed APIs using gRPC generated clients that benefits from ServiceStack's simplified gRPC tooling and reuse of existing HTTP APIs
Learn more →
In this video we'll walk through configuring Flutter and gRPC .NET Services with the flutter-grpc mix template
to add a new Flutter application using your locally installed Flutter SDK to an existing ServiceStack grpc project
that has been configured to support gRPC services
In this video we walk through how to enable gRPC endpoints for your existing ServiceStack services
and how the x dotnet tool greatly
simplifies the development workflow of maintaining in-sync client integrations in a simple and consistent
way across all gRPC languages
In this example we'll walk through creating a new Flutter Mobile App with a
.NET API backend and demonstrate the development workflow of calling new .NET APIs
with typed client APIs from Flutter
Both Flutter and .NET have great CLI tooling where you can get a great development experience using a
text editor like
VS Code
with its great multi-terminal support, or if preferred, full-featured IDEs like
Android Studio
and
JetBrains Rider
for even richer tooling.
1. Create your .NET Project
Start with your preferred project,
or create an empty Project with your preferred project name:
That can be run immediately in the Host project with dotnet watch for a live reload dev UX:
2. Add a new Flutter App to your project
Then from a new Terminal in your Solution folder (e.g. MyApp), add a new Flutter App with:
This will run flutter create to add a new Flutter App to your solution that should look like:
It also adds the servicestack client library package that's pre-configured to
call the default Hello API in new ServiceStack projects which we can test
by running fluter from myapp_flutter:
We recommend choosing [1] to run the Flutter App as a Windows Desktop App for the best dev UX on Windows,
which after a few moments should open the Hello App in a Desktop App:
3. Create your .NET API
Lets create a new API to preview the typical dev workflow of calling new .NET APIs from Flutter.
First we'll want to define our API's Service Contract with the Request and Response DTOs the API
will accept and return in:
MyApp.ServiceModel/SearchFiles.cs
using ServiceStack;
using System.Collections.Generic;
namespace MyApp.ServiceModel;
public class SearchFiles : IReturn<SearchFilesResponse>
{
public string Pattern { get; set; }
}
public class SearchFilesResponse
{
public List<string> Results { get; set; }
}
Then add its Implementation that scans the .NET App's folder for files and returns the results:
MyApp.ServiceInterface/SearchFilesService.cs
using ServiceStack;
using MyApp.ServiceModel;
namespace MyApp.ServiceInterface;
public class SearchFilesServices : Service
{
public object Any(SearchFiles request)
{
var files = VirtualFiles.GetAllMatchingFiles(request.Pattern ?? "*");
return new SearchFilesResponse {
Results = files.Map(x => x.VirtualPath)
};
}
}
dotnet watch should automatically detect the changes and reload the App to take effect.
3. Update Flutter App
Then to update our clients Dart DTOs we just need to run x dart from the Flutter project:
Which can now be used in our App, by replacing the callService() and build() methods with:
Which after a restart should now call our new SearchFiles API returning .NET App files that
match the specified pattern:
We hope this was a good waltkthrough to showcase the simplified end-to-end typed dev model for working
with ServiceStack's APIs, be sure to check out the
Flutter videos for more in-depth
explanations or head over to our
Support Channels
if you have any issues or questions.