tree: 4009f796a7a10def0c08461026745cc52f335469 [path history] [tgz]
  1. examples/
  2. meta/
  3. BUILD.bazel
  4. build_and_run_sample_app.sh
  5. embedder.h
  6. engine_revision
  7. libflutter_engine.so
  8. main.cc
  9. OWNERS
  10. README.md
src/flutter_embedder/README.md

Flutter Embedder

The Flutter Embedder for Fuchsia is a new in-progress runtime for Flutter apps on Fuchsia. This runtime is built on top of Flutter's embedder platform.

Running a sample app using the embedder

TODO(akbiggs): The embedder is very early days and does not render apps yet.

TODO(akbiggs): Port this workflow to using OOT workstation instead of in-tree.

  1. Prerequisites:
  • $WORKSTATION_REPO is set to your workstation.git checkout directory.

  • $FUCHSIA_DIR is set to your fuchsia.git checkout directory.

  • flutter tool is in your $PATH.

  • Cherry-pick https://fxrev.dev/664586 into your fuchsia.git checkout directory:

    pushd && cd $FUCHSIA_DIR && git fetch https://fuchsia.googlesource.com/fuchsia refs/changes/86/664586/1 && git cherry-pick FETCH_HEAD && popd
    
  1. Boot up Workstation in an emulator:

    cd $FUCHSIA_DIR && fx set workstation.x64 && fx build && fx vdl start -N
    
  2. In a second terminal, start your package server:

    cd $FUCHSIA_DIR && fx serve
    
  3. In a third terminal, build and run the sample app:

    $WORKSTATION_REPO/flutter_embedder/build_and_run_sample_app.sh
    

Why is the embedder in workstation.git?

This is a temporary location. The long-term location for this embedder is flutter-embedder.git. We are not storing this embedder in there for now because it is easier to prototype and develop the embedder using the build rules in workstation.git and with direct access to the Workstation code.

We should migrate this code to flutter-embedder.git once the Bazel SDK is more stable.

Code breakdown

libflutter_engine.so

This is an unoptimized build of the Flutter embedder platform built for OS_FUCHSIA. This build contains a few changes that have not been landed into the Flutter Engine repository:

  1. Add -fPIC to Fuchsia builds.
  2. Fix JIT snapshot support for the embedder platform.

These changes should be landed and libflutter_engine.so should be pulled from a CIPD bucket instead.

embedder.h

This is a copy of the Flutter embedder platform header from the Engine repository: https://github.com/flutter/engine/blob/main/shell/platform/embedder/embedder.h

engine_revision

The git hash of Flutter Engine that the Engine artifacts come from. Currently, this is purely for developer reference and is not used by any tooling.