Running a Flutter App on Fuchsia with FImage
This guide assumes you have already configured FImage for Flutter development. If you have not, see Setting up FImage for Application Development. Flutter should work fine with most apps. If your application uses 3rd-party packages that doesn't support Fuchsia, it might not work.
Before you can deploy your Flutter app, you must register FImage's SSH configuration with the Flutter tool.
From inside the FImage directory, run:
If you want the configuration to be persistent, add that command to your shell's init script.
Head over to your Flutter app's folder. For this example we will be using the dahliaOS Calculator (opens in a new tab). From the root of your Flutter app, create the folder
fuchsia, and inside of that, create the folder
meta. Inside of the newly created
meta directory, create a file called
calculator.cmx. You should have created the following directory structure inside of your Flutter app's folder:
calculator/fuchsia └── meta └── calculator.cmx
Inside of the file
calculator.cmx, add the following content for a basic Flutter App:
You may need to tweak this to be compatible with more complicated applications. See the Component Manifest (opens in a new tab) document on fuchsia.dev for more information.
Now that the application is modified to work with Fuchsia, open another terminal window and start FImage:
Once the emulator is started and on the home screen, it should show up under
flutter devices. You can now run the application using the following command:
flutter run -d fuchsia --verbose
The application should compile and launch on the virtual device.