@@ -228,6 +228,21 @@ void onAttach(@NonNull Context context) {
228
228
return activity ;
229
229
}
230
230
231
+ private FlutterEngine createEngineFromGroup (FlutterEngineGroup flutterEngineGroup ) {
232
+ String appBundlePathOverride = host .getAppBundlePath ();
233
+ if (appBundlePathOverride == null || appBundlePathOverride .isEmpty ()) {
234
+ appBundlePathOverride = FlutterInjector .instance ().flutterLoader ().findAppBundlePath ();
235
+ }
236
+
237
+ DartExecutor .DartEntrypoint dartEntrypoint =
238
+ new DartExecutor .DartEntrypoint (
239
+ appBundlePathOverride , host .getDartEntrypointFunctionName ());
240
+ flutterEngine =
241
+ flutterEngineGroup .createAndRunEngine (
242
+ host .getContext (), dartEntrypoint , host .getInitialRoute ());
243
+ isFlutterEngineFromHost = false ;
244
+ }
245
+
231
246
/**
232
247
* Obtains a reference to a FlutterEngine to back this delegate and its {@code host}.
233
248
*
@@ -285,18 +300,7 @@ void onAttach(@NonNull Context context) {
285
300
+ "'" );
286
301
}
287
302
288
- String appBundlePathOverride = host .getAppBundlePath ();
289
- if (appBundlePathOverride == null || appBundlePathOverride .isEmpty ()) {
290
- appBundlePathOverride = FlutterInjector .instance ().flutterLoader ().findAppBundlePath ();
291
- }
292
-
293
- DartExecutor .DartEntrypoint dartEntrypoint =
294
- new DartExecutor .DartEntrypoint (
295
- appBundlePathOverride , host .getDartEntrypointFunctionName ());
296
- flutterEngine =
297
- flutterEngineGroup .createAndRunEngine (
298
- host .getContext (), dartEntrypoint , host .getInitialRoute ());
299
- isFlutterEngineFromHost = false ;
303
+ flutterEngine = createEngineFromGroup (flutterEngineGroup );
300
304
return ;
301
305
}
302
306
@@ -311,12 +315,7 @@ void onAttach(@NonNull Context context) {
311
315
engineGroup == null
312
316
? new FlutterEngineGroup (host .getContext (), host .getFlutterShellArgs ().toArray ())
313
317
: engineGroup ;
314
- flutterEngine =
315
- group .createAndRunEngine (
316
- new FlutterEngineGroup .Options (host .getContext ())
317
- .setAutomaticallyRegisterPlugins (false )
318
- .setWaitForRestorationData (host .shouldRestoreAndSaveState ()));
319
- isFlutterEngineFromHost = false ;
318
+ flutterEngine = createEngineFromGroup (engineGroup );
320
319
}
321
320
322
321
/**
0 commit comments