Setting up FImage for Application Development
This guide will explain how to bring your existing Flutter application to Fuchsia using the Flutter SDK and FImage.
You'll need a few things before working with Flutter apps on Fuchsia:
- A working installation of the latest version of the FImage tool.
- The Flutter SDK.
Begin by upgrading Flutter to the
flutter channel master
Then, Enable Fuchsia development, and upgrade the Flutter tool. It should download the Fuchsia SDK. If
flutter devices does not list the
fuchsia_fimage device, run this step again.
flutter config --enable-fuchsia flutter upgrade
To start, generate a new set of SSH keys for the emulator:
For the sake of organization, call the key
fimage_key. Don't set a password for the keypair. You should see an output similar to below.
Generating public/private rsa key pair. Enter file in which to save the key (/home/nmcain/.ssh/id_rsa): fimage_key Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in fimage_key Your public key has been saved in fimage_key.pub The key fingerprint is: SHA256:yJz40GaEI+pyfBaTgC9n2HGlGDBEBVYeLVV3PyCd99A nmcain@OptiPlex-790 The key's randomart image is: +---[RSA 3072]----+ |=*=+o.o. o.o. . | |.o.+.= . oooo E | |. =.* . .oo | | = = O o .. | |+ = * O S | |.= B | |..o o . | |.. o | | | +----[SHA256]-----+
Now that the key has been generated, send the public key to FImage. Make sure the emulator is not started, and use the ZBI tool to inject the key.
./tools/zbi -o init/fuchsia-ssh.zbi init/fuchsia.zbi --replace --entry data/ssh/authorized_keys=/home/$USER/.ssh/fimage_key.pub
Now that SSH and the SDK are configured, you can start FImage by running:
./network-config ./fimage-gui 4096
In a new terminal, check that the emulator is running and recognized by Flutter, using the
flutter devices command as shown below:
Your device is now ready to run Flutter apps!
The instructions for this step can be found at Preparing and Running a Flutter App.