App.create constructor

App.create({
  1. required Widget widget,
  2. List<AppProvider>? appProviders,
  3. GlobalKey<NavigatorState>? navigatorKey,
  4. List<ErrorListener>? errorListeners,
})

Creates the app.

Implementation

factory App.create({
  required Widget widget,
  List<AppProvider>? appProviders,
  GlobalKey<NavigatorState>? navigatorKey,
  List<ErrorListener>? errorListeners,
}) {
  if (null != _instance) {
    throw AlbaError('App is already created!');
  }

  _instance = App._(
    widget: widget,
    appProviders: appProviders,
    navigatorKey: navigatorKey,
    errorListeners: errorListeners ?? [DebugErrorListener()],
  );

  return _instance!;
}