Home > OS >  Getting lateInitializationError: context whenever there I use Screen Util
Getting lateInitializationError: context whenever there I use Screen Util

Time:04-02

I get this error when the app builds but there is no error in the IDE, and I Have tried both Constructors for the flutter_screenutil package to no avail.

ScreenUtilInit(
    designSize: Size(360, 690),
    minTextAdapt: true,
    splitScreenMode: true,
    builder: () =>
        MaterialApp(
          builder: (context, widget) {
            ScreenUtil.setContext(context);

            return MediaQuery(
              data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
              child: widget,
            );
          },
      navigatorKey: locator<NavigationService>().navigatorKey,
      home:
      !loading && isLogin ?
      SplashScreen()
          : MyHomePage(),),),);

CodePudding user response:

As reported on the GitHub repo of the package flutter_screenutil https://github.com/OpenFlutter/flutter_screenutil/issues/317#issuecomment-1032694269

  • Related