FlutterFragment allows developers to control the following
details of the Flutter experience within the Fragment:

Initial Flutter route

Dart entrypoint to execute

Opaque vs translucent background

Whether FlutterFragment should control its surrounding Activity

Whether a new FlutterEngine or a cached FlutterEngine should be used

FlutterFragment also comes with a number of calls that
must be forwarded from its surrounding Activity.
These calls allow Flutter to react appropriately to OS events.

All varieties of FlutterFragment, and its requirements,
are described in this guide.

Add a FlutterFragment to an Activity with a new FlutterEngine

The first thing to do to use a FlutterFragment is to add it to a host
Activity.

To add a FlutterFragment to a host Activity, instantiate and
attach an instance of FlutterFragment in onCreate() within the
Activity, or at another time that works for your app:

Java