application method

Widget application({
  1. required AppModel app,
  2. required bool asPlaystore,
})

Implementation

Widget application({required AppModel app, required bool asPlaystore}) {
  String? initialFragment;
  if (kIsWeb) {
    if (Uri.base.hasFragment) {
      initialFragment = Uri.base.fragment;
    }
  }

  var appId = app.documentID;

  var initialRoute =
      initialFragment ?? '$appId/${app.homePages!.homePagePublic!}';

//    initialRoute = "MINKEY_APP/d33da4b8-7179-4fac-b8db-ddc997c2d61a?open-dialog=member_dashboard";

  var accessBloc = AccessBloc(navigatorKey)
    ..add(AccessInitEvent(app, asPlaystore ? app : null));

  var myRouter = eliudrouter.Router(accessBloc);

  return BlocProvider<AccessBloc>(
      create: (context) => accessBloc,
      child: MaterialApp(
          key: _appKey,
          debugShowCheckedModeBanner: false,
          navigatorKey: navigatorKey,
          scaffoldMessengerKey: rootScaffoldMessengerKey,
          initialRoute: initialRoute,
          onGenerateRoute: myRouter.generateRoute,
          onUnknownRoute: (RouteSettings setting) {
            return pageRouteBuilder(app,
                page: AlertWidget(
                    app: app, title: 'Error', content: 'Page not found'));
          },
          title: app.title ?? 'No name'));
}