Debugging in PlatformChannel configuration

 

In this section we show the correct way to debug a Flutnet application with the FlutnetBridge mode set to PlatformChannel.

 

Premises

We assume that you have configured correctly the FlutnetBridge for both your Xamarin project (Android or iOS) and you Flutter module. Even that we assume you have build your Flutter module, depending on the destination application (Android or iOS).

See Write your first Flutnet app for more details about how to build your Flutnet app.

 

 

Open your Xamarin project on Visual Studio and the Flutter module project using your proferred IDE (we use Visual Studio Code).

 

All the steps are described in the list below:

  1. Run your app using Visual Studio (just a Xamarin project): the app will start together its flutter module.
  2. Connect to Flutter module in order to debug it
    1. From Visual Studio Code open the file main.dart
    2. Press F1 and from the drop down menu select "Attach to Flutter process"
    3. In case of URI Observatory request, just press Enter
  3. In case of URI Observatory request, just press Enter
  4. Wait until Visual Studio code is connected (it may take some time). 
  5. Now you can debug and use the Flutter debug futures like hot reload.

For more details see Flutter Testing & Debugging.

Important note
Every change made to Flutter in this configuration affect only the module during the runtime session. When you restart the Xamarin application all the changes blow away.
In order see the change at the start you need to recompile the Flutter module.
A good practice is to clean and rebuild even your Xamarin project and remove the old version of the app in your emulator or device.

Testing And Debug Photos

Screenshots about the full procedure