Skip to content

Instantly share code, notes, and snippets.

@kmmraj
Created June 29, 2020 13:19
Show Gist options
  • Save kmmraj/b4b6a31e8acff9c34fdd0267f59c7677 to your computer and use it in GitHub Desktop.
Save kmmraj/b4b6a31e8acff9c34fdd0267f59c7677 to your computer and use it in GitHub Desktop.
class AppController : Application() {
lateinit var engine: FlutterEngine
override fun onCreate() {
super.onCreate()
// Instantiate a FlutterEngine.
engine = FlutterEngine(this)
// Start executing Dart code to pre-warm the FlutterEngine.
engine.dartExecutor.executeDartEntrypoint(
DartExecutor.DartEntrypoint.createDefault()
)
// Cache the FlutterEngine to be used by FlutterActivity.
FlutterEngineCache
.getInstance()
.put("my_engine_id", engine)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment