createCupertinoWidget method Null safety

  1. @override
CupertinoApp createCupertinoWidget(
  1. BuildContext context
)
override

Implementation

@override
createCupertinoWidget(BuildContext context) {
  final dataRouter = cupertinoRouter?.call(context, platform(context));

  if (routeInformationParser != null ||
      dataRouter?.routeInformationParser != null) {
    assert(dataRouter?.routerDelegate != null || routerDelegate != null);

    return CupertinoApp.router(
      routeInformationProvider:
          dataRouter?.routeInformationProvider ?? routeInformationProvider,
      routeInformationParser:
          dataRouter?.routeInformationParser ?? routeInformationParser!,
      routerDelegate: dataRouter?.routerDelegate ?? routerDelegate!,
      backButtonDispatcher:
          dataRouter?.backButtonDispatcher ?? backButtonDispatcher,
      theme: dataRouter?.theme,
      builder: dataRouter?.builder ?? builder,
      title: dataRouter?.title ?? title ?? '',
      onGenerateTitle: dataRouter?.onGenerateTitle ?? onGenerateTitle,
      color: dataRouter?.color ?? color,
      locale: dataRouter?.locale ?? locale,
      localizationsDelegates:
          dataRouter?.localizationsDelegates ?? localizationsDelegates,
      localeListResolutionCallback:
          dataRouter?.localeListResolutionCallback ??
              localeListResolutionCallback,
      localeResolutionCallback:
          dataRouter?.localeResolutionCallback ?? localeResolutionCallback,
      supportedLocales: dataRouter?.supportedLocales ??
          supportedLocales ??
          const <Locale>[Locale('en', 'US')],
      showPerformanceOverlay: dataRouter?.showPerformanceOverlay ??
          showPerformanceOverlay ??
          false,
      checkerboardRasterCacheImages:
          dataRouter?.checkerboardRasterCacheImages ??
              checkerboardRasterCacheImages ??
              false,
      checkerboardOffscreenLayers: dataRouter?.checkerboardOffscreenLayers ??
          checkerboardOffscreenLayers ??
          false,
      showSemanticsDebugger:
          dataRouter?.showSemanticsDebugger ?? showSemanticsDebugger ?? false,
      debugShowCheckedModeBanner: dataRouter?.debugShowCheckedModeBanner ??
          debugShowCheckedModeBanner ??
          true,
      shortcuts: dataRouter?.shortcuts ?? shortcuts,
      actions: dataRouter?.actions ?? actions,
      key: dataRouter?.widgetKey ?? widgetKey,
      restorationScopeId:
          dataRouter?.restorationScopeId ?? restorationScopeId,
    );
  } else {
    final data = cupertino?.call(context, platform(context));
    return CupertinoApp(
      key: data?.widgetKey ?? widgetKey,
      navigatorKey: data?.navigatorKey ?? navigatorKey,
      home: data?.home ?? home,
      routes: data?.routes ?? routes ?? const <String, WidgetBuilder>{},
      initialRoute: data?.initialRoute ?? initialRoute,
      onGenerateRoute: data?.onGenerateRoute ?? onGenerateRoute,
      onUnknownRoute: data?.onUnknownRoute ?? onUnknownRoute,
      navigatorObservers: data?.navigatorObservers ??
          navigatorObservers ??
          const <NavigatorObserver>[],
      builder: data?.builder ?? builder,
      title: data?.title ?? title ?? '',
      onGenerateTitle: data?.onGenerateTitle ?? onGenerateTitle,
      color: data?.color ?? color,
      locale: data?.locale ?? locale,
      localizationsDelegates:
          data?.localizationsDelegates ?? localizationsDelegates,
      localeListResolutionCallback:
          data?.localeListResolutionCallback ?? localeListResolutionCallback,
      localeResolutionCallback:
          data?.localeResolutionCallback ?? localeResolutionCallback,
      supportedLocales: data?.supportedLocales ??
          supportedLocales ??
          const <Locale>[Locale('en', 'US')],
      showPerformanceOverlay:
          data?.showPerformanceOverlay ?? showPerformanceOverlay ?? false,
      checkerboardRasterCacheImages: data?.checkerboardRasterCacheImages ??
          checkerboardRasterCacheImages ??
          false,
      checkerboardOffscreenLayers: data?.checkerboardOffscreenLayers ??
          checkerboardOffscreenLayers ??
          false,
      showSemanticsDebugger:
          data?.showSemanticsDebugger ?? showSemanticsDebugger ?? false,
      debugShowCheckedModeBanner: data?.debugShowCheckedModeBanner ??
          debugShowCheckedModeBanner ??
          true,
      theme: data?.theme,
      shortcuts: data?.shortcuts ?? shortcuts,
      actions: data?.actions ?? actions,
      onGenerateInitialRoutes:
          data?.onGenerateInitialRoutes ?? onGenerateInitialRoutes,
      restorationScopeId: data?.restorationScopeId ?? restorationScopeId,
    );
  }
}