5package io.flutter.embedding.engine;
8import androidx.annotation.NonNull;
9import androidx.annotation.Nullable;
10import androidx.annotation.VisibleForTesting;
11import io.flutter.FlutterInjector;
12import io.flutter.embedding.engine.dart.DartExecutor.DartEntrypoint;
13import io.flutter.embedding.engine.loader.FlutterLoader;
14import io.flutter.plugin.platform.PlatformViewsController;
15import java.util.ArrayList;
61 if (!loader.initialized()) {
99 @NonNull Context context, @Nullable
DartEntrypoint dartEntrypoint) {
118 @NonNull Context context,
120 @Nullable String initialRoute) {
122 new Options(context).setDartEntrypoint(dartEntrypoint).setInitialRoute(initialRoute));
142 Context context =
options.getContext();
144 String initialRoute =
options.getInitialRoute();
147 platformViewsController =
149 boolean automaticallyRegisterPlugins =
options.getAutomaticallyRegisterPlugins();
150 boolean waitForRestorationData =
options.getWaitForRestorationData();
152 if (dartEntrypoint ==
null) {
160 platformViewsController,
161 automaticallyRegisterPlugins,
162 waitForRestorationData);
163 if (initialRoute !=
null) {
164 engine.getNavigationChannel().setInitialRoute(initialRoute);
166 engine.getDartExecutor().executeDartEntrypoint(dartEntrypoint, dartEntrypointArgs);
176 platformViewsController,
177 automaticallyRegisterPlugins,
178 waitForRestorationData);
184 engine.addEngineLifecycleListener(
188 public void onPreEngineRestart() {
193 public void onEngineWillDestroy() {
204 boolean automaticallyRegisterPlugins,
205 boolean waitForRestorationData) {
210 platformViewsController,
212 automaticallyRegisterPlugins,
213 waitForRestorationData,
219 @NonNull
private Context context;
221 @Nullable
private String initialRoute;
224 private boolean automaticallyRegisterPlugins =
true;
225 private boolean waitForRestorationData =
false;
228 this.context = context;
241 return dartEntrypoint;
254 return dartEntrypointArgs;
259 return platformViewsController;
267 return automaticallyRegisterPlugins;
276 return waitForRestorationData;
287 this.dartEntrypoint = dartEntrypoint;
298 this.initialRoute = initialRoute;
308 this.dartEntrypointArgs = dartEntrypointArgs;
319 this.platformViewsController = platformViewsController;
331 this.automaticallyRegisterPlugins = automaticallyRegisterPlugins;
344 this.waitForRestorationData = waitForRestorationData;
Options setInitialRoute(String initialRoute)
Options setDartEntrypointArgs(List< String > dartEntrypointArgs)
PlatformViewsController getPlatformViewsController()
boolean getWaitForRestorationData()
Options setPlatformViewsController( @NonNull PlatformViewsController platformViewsController)
Options setWaitForRestorationData(boolean waitForRestorationData)
boolean getAutomaticallyRegisterPlugins()
List< String > getDartEntrypointArgs()
Options setDartEntrypoint(DartEntrypoint dartEntrypoint)
Options(@NonNull Context context)
DartEntrypoint getDartEntrypoint()
Options setAutomaticallyRegisterPlugins(boolean automaticallyRegisterPlugins)
FlutterEngine createAndRunDefaultEngine(@NonNull Context context)
final List< FlutterEngine > activeEngines
FlutterEngineGroup(@NonNull Context context, @Nullable String[] dartVmArgs)
FlutterEngine createAndRunEngine( @NonNull Context context, @Nullable DartEntrypoint dartEntrypoint, @Nullable String initialRoute)
FlutterEngine createAndRunEngine(@NonNull Options options)
FlutterEngineGroup(@NonNull Context context)
FlutterEngine createAndRunEngine( @NonNull Context context, @Nullable DartEntrypoint dartEntrypoint)
FlutterEngine createEngine(Context context, @NonNull PlatformViewsController platformViewsController, boolean automaticallyRegisterPlugins, boolean waitForRestorationData)
static DartEntrypoint createDefault()
void ensureInitializationComplete( @NonNull Context applicationContext, @Nullable String[] args)
void startInitialization(@NonNull Context applicationContext)