Flutnet Project Structure

 

Before deeping how to Write your first Flutnet app
 

We need to understand the basics about a Flutnet Project and the concept of all its parts.

 

This section will cover:

 

 

 


Project directory structure

The first thing to do is create the project using Flutnet UI tool.

 

The default configuration for a project named "MyFirstApp" will generate a directory structured like the image below.

 

The directory have assumed the name of the project and inside it we can find:
 

  • the Xamarin solution named MyFirstApp.sln, that contains all the relative Xamarin projects → open it with Visual Studio.
    • MyFirstApp.Android contains the Android app project
    • MyFirstApp.iOS contains the iOS app project
    • MyFirstApp.ServiceLibrary contains all the shared code between Android, iOS and Flutter (see PlatformService)
    • MyFirstApp.ModuleInterop.Android used to link Flutter(Android) and Xamarin(Android) together →  Never edit this project
    • MyFirstApp.PluginInterop.iOS used only in case you need some flutter plugins for ios project. (See the example Flutnet-Video-Player-Plugin for more details).
       
  • The related Flutter projects (UI+bridge)
    • ​The UI project (flutter module)  my_first_app → open it with Visual Studio Code.
    • The my_first_app_bridge (bridge package) project​​ that contains
      • core communication between Xamarin and Flutter
      • all the PlatformService the you want to export from the *.ServiceLibrary project
      • all the Dart code is generated by the $ flutnet pack command

 

 If you never developed a Flutter application, just follow the official guide at following link: Write your first Flutter app.

 

 

 


Flutnet solution and dependencies

 

When we open a Flutnet solution in Visual Studio, we will find a situation like this

 

A Flutnet project is composed by four projects, each one with specific Nuget package:

  1. Xamarin Android → Flutnet.Android (NuGet pkg)



     
  2. Xamarin iOS → Flutnet.iOS (NuGet pkg)



     
  3. Xamarin ServiceLibrary  → Flutnet.ServiceModel (NuGet pkg)


     
  4. Xamarin InteropModule Android → Flutnet.Interop.Android (NuGet pkg)



     

 

 

Here you can see the dependencies tree for Flutnet Nuget Packages