Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #227

Open
thisadee2897 opened this issue Feb 24, 2024 · 3 comments

Comments

@thisadee2897
Copy link

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.

Copy link

Thanks for taking the time to open an issue. I will have a look and answer as soon as possible.

@thisadee2897
Copy link
Author

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

@thisadee2897 thisadee2897 changed the title EasyLoading 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 Feb 24, 2024
@mdabusaif
Copy link

#215 (comment)

@thisadee2897 Check here. This will solve your issue I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants