appTemplate top-level constant
String
const appTemplate
appTemplate
this will be use in order to create app.dart for export and import
Implementation
const String appTemplate = """import 'core.dart';\n
/// ### `MyApp`
///
/// `Description`: the main application wrapper
///
/// Example:
/// ```dart
/// void main() async {
///
/// WidgetsFlutterBinding.ensureInitialized();
/// var authenticationController = AuthenticationController();
/// runApp(MyApp(authenticationController: authenticationController)));
/// }
/// ```
class MyApp extends StatelessWidget {
final AuthenticationController authenticationController;
const MyApp({
Key? key,
required this.authenticationController,
}) : super(key: key);
static const String title = "MyApp";
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider<ApplicationController>(
create: (_) => ApplicationController()
),
ChangeNotifierProvider<AuthenticationController>(
create: (_) => authenticationController,
),
Provider<MyRouter>(
lazy: false,
create: (_) => MyRouter(authenticationController),
),
],
child: Builder(builder: (context) {
final router = Provider.of<MyRouter>(context, listen: false).router;
return MaterialApp.router(
debugShowCheckedModeBanner: false,
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
title: MyApp.title,
theme: lightTheme,
darkTheme: darkTheme,
themeMode: context.select<ApplicationController, ThemeMode>((ctrl) => ctrl.themeMode) ,
routeInformationParser: router.routeInformationParser,
routerDelegate: router.routerDelegate,
);
}),
);
}
}
""";