Interface FlutterEngineProvider

All Known Implementing Classes:
FlutterActivity, FlutterFragment, FlutterFragmentActivity

public interface FlutterEngineProvider
Provides a FlutterEngine instance to be used by a FlutterActivity or 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 FlutterActivitys and/or FlutterFragments. This interface facilitates providing a cached, pre-warmed FlutterEngine.

  • Method Details

    • provideFlutterEngine

      @Nullable FlutterEngine provideFlutterEngine(@NonNull Context context)
      Returns the 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.

      context - The current context. e.g. An activity.
      The Flutter engine.