Open thisadee2897 opened 7 months ago
Thanks for taking the time to open an issue. I will have a look and answer as soon as possible.
void main() async { EasyLoading.init(); WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setSystemUIOverlayStyle( const SystemUiOverlayStyle( statusBarColor: Colors.transparent, systemNavigationBarColor: Colors.transparent, systemNavigationBarDividerColor: Colors.transparent, statusBarIconBrightness: Brightness.dark, systemNavigationBarIconBrightness: Brightness.dark, ), ); await initializeDateFormatting('th', null); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); SharedPreferences prefs = await SharedPreferences.getInstance(); bool isLoggedIn = prefs.getBool('isLoggedIn') ?? false; runApp(MyApp(isLoggedIn: isLoggedIn)); App.configLoading(); }
class MyApp extends StatelessWidget { final bool isLoggedIn; const MyApp({super.key, this.isLoggedIn = false}); @override Widget build(BuildContext context) { return GetMaterialApp( builder: (context, child) { // EasyLoading.init(); return MediaQuery( data: MediaQuery.of(context).copyWith( textScaler: TextScaler.noScaling, ), child: child!, ); }, showSemanticsDebugger: false, localizationsDelegates: App.localizations(), supportedLocales: App.local(), theme: App.themeLight(), darkTheme: App.themeLight(), themeMode: ThemeMode.light, debugShowCheckedModeBanner: false, initialBinding: InitialBinding(), initialRoute: isLoggedIn ? BottomNavBar.id : LoginPage.id, getPages: AppPages.pages, ); } }
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter_easyloading/src/easy_loading.dart': Failed assertion: line 425 pos 7: 'overlayEntry != null': You should call EasyLoading.init() in your MaterialApp
https://github.com/nslogx/flutter_easyloading/issues/215#issuecomment-1662461919
@thisadee2897 Check here. This will solve your issue I believe.
Describe the bug A clear and concise description of what the bug is.
Flutter/Dart info please run
flutter doctor
then put it here.Screenshots If applicable, add screenshots to help explain your problem.