public static interface FlutterFragment.FlutterEngineProvider
FlutterEngine
instance to be used by a FlutterFragment
.
FlutterEngine
instances require significant time to warm up. Therefore, a developer
might choose to hold onto an existing FlutterEngine
and connect it to various
FlutterActivity
s and/or FlutterFragments
.
If the FragmentActivity
that owns this FlutterFragment
implements
FlutterEngineProvider
, that FlutterActivity
will be given an opportunity
to provide a FlutterEngine
instead of the FlutterFragment
creating a
new one. The FragmentActivity
can provide an existing, pre-warmed FlutterEngine
,
if desired.
See FlutterFragment.setupFlutterEngine()
for more information.
Modifier and Type | Method and Description |
---|---|
FlutterEngine |
getFlutterEngine(Context context)
Returns the
FlutterEngine that should be used by a child FlutterFragment . |
@Nullable FlutterEngine getFlutterEngine(@NonNull Context context)
FlutterEngine
that should be used by a child FlutterFragment
.
This method may return a new FlutterEngine
, an existing, cached FlutterEngine
,
or null to express that the FlutterEngineProvider
would like the FlutterFragment
to provide its own FlutterEngine
instance.