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

Facing issue in initialization of flutter_easyloading. #215

Closed
vijayvaghela72 opened this issue Jul 30, 2023 · 6 comments
Closed

Facing issue in initialization of flutter_easyloading. #215

vijayvaghela72 opened this issue Jul 30, 2023 · 6 comments

Comments

@vijayvaghela72
Copy link

i am using code as below ,

GetMaterialApp(
        builder: (context, child) {
          EasyLoading.init();
          return MediaQuery(
            data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
            child: child!,
          );
        },
        title: 'Ardent Sports',
        debugShowCheckedModeBanner: false,
        theme: ThemeData.dark().copyWith(),
        routes: {
          '/': (context) => const SplashScreen(),
        },
      ),
    );
    
    ```
    
    
    but in above case it's not working file ,
    
    ```
    GetMaterialApp(
        builder: EasyLoading.init(),
        title: 'Ardent Sports',
        debugShowCheckedModeBanner: false,
        theme: ThemeData.dark().copyWith(),
        routes: {
          '/': (context) => const SplashScreen(),
        },
      ),
    ```
    
    in above code it's working fine but i also have to add as first code ,
    
    so in this case how can i add 
    
    ```
      builder: (context, child) {
          EasyLoading.init();
          return MediaQuery(
            data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
            child: child!,
          );
          ```
          
          please provide me solution in this situation .
          
          
          facing below issue ,
     [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
@github-actions
Copy link

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

@vijayvaghela72
Copy link
Author

also i have try

GetMaterialApp(
  title: 'Ardent Sports',
  debugShowCheckedModeBanner: false,
  theme: ThemeData.dark().copyWith(),
  routes: {
    '/': (context) => const SplashScreen(),
  },
  builder: (context, child) {
    return MediaQuery(
      data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
      child: child!,
    );
  },
  onInit: EasyLoading.init,
);

above code but not working fine .

@vijayvaghela72
Copy link
Author

if you need more detail please let me know .

@vijayvaghela72
Copy link
Author

any update ?

@erdemyerebasmaz
Copy link

erdemyerebasmaz commented Aug 2, 2023

@vijayvaghela72 EasyLoading.init() has a builder parameter. You need to declare your existing builder there.

GetMaterialApp(
  builder: EasyLoading.init(
    builder: (BuildContext context, Widget child) {
      return MediaQuery(
        data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
        child: child!,
      );
    },
  ),
  title: 'Ardent Sports',
  debugShowCheckedModeBanner: false,
  theme: ThemeData.dark().copyWith(),
  routes: {
    '/': (context) => const SplashScreen(),
  },
);
      

Please close the issue afterwards but I do believe this needs to be better documented.

@vijayvaghela72
Copy link
Author

ohh noted Thanks for pointing out. @erdemyerebasmaz

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