@@ -228,6 +228,18 @@ void onAttach(@NonNull Context context) {
228
228
return activity ;
229
229
}
230
230
231
+ private FlutterEngineGroup .Options addEntrypointOptions (FlutterEngineGroup .Options options ) {
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
+ return options .setDartEntrypoint (dartEntrypoint ).setInitialRoute (host .getInitialRoute ());
241
+ }
242
+
231
243
/**
232
244
* Obtains a reference to a FlutterEngine to back this delegate and its {@code host}.
233
245
*
@@ -285,17 +297,9 @@ void onAttach(@NonNull Context context) {
285
297
+ "'" );
286
298
}
287
299
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
300
flutterEngine =
297
301
flutterEngineGroup .createAndRunEngine (
298
- host . getContext (), dartEntrypoint , host .getInitialRoute ( ));
302
+ addEntrypointOptions ( new FlutterEngineGroup . Options ( host .getContext ()) ));
299
303
isFlutterEngineFromHost = false ;
300
304
return ;
301
305
}
@@ -313,9 +317,10 @@ void onAttach(@NonNull Context context) {
313
317
: engineGroup ;
314
318
flutterEngine =
315
319
group .createAndRunEngine (
316
- new FlutterEngineGroup .Options (host .getContext ())
317
- .setAutomaticallyRegisterPlugins (false )
318
- .setWaitForRestorationData (host .shouldRestoreAndSaveState ()));
320
+ addEntrypointOptions (
321
+ new FlutterEngineGroup .Options (host .getContext ())
322
+ .setAutomaticallyRegisterPlugins (false )
323
+ .setWaitForRestorationData (host .shouldRestoreAndSaveState ())));
319
324
isFlutterEngineFromHost = false ;
320
325
}
321
326
0 commit comments