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

overlayEntry should not be null #84

Closed
stoppiNeobiz opened this issue Jan 7, 2021 · 6 comments
Closed

overlayEntry should not be null #84

stoppiNeobiz opened this issue Jan 7, 2021 · 6 comments

Comments

@stoppiNeobiz
Copy link

Describe the bug
I receive an error from flutter
[VERBOSE-2:ui_dart_state.cc(177)] Unhandled Exception: 'package:flutter_easyloading/src/easy_loading.dart': Failed assertion: line 428 pos 7: 'overlayEntry != null': overlayEntry should not be null

Flutter/Dart info
please run flutter doctor then put it here.

Screenshots
If applicable, add screenshots to help explain your problem.

@github-actions
Copy link

github-actions bot commented Jan 7, 2021

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

@nslogx
Copy link
Owner

nslogx commented Jan 7, 2021

@stoppiNeobiz

Initialize EasyLoading in your MaterialApp

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter EasyLoading',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter EasyLoading'),
      builder: EasyLoading.init(),
    );
  }
}

@nslogx nslogx closed this as completed Jan 13, 2021
@BartusZak
Copy link

BartusZak commented Feb 9, 2021

@kokohuang how can I do that with more advanced builder configuration?

 @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      debugShowCheckedModeBanner: false,
      key: _navigatorKey,
      title: 'Title',
      theme: ThemeData(
        primarySwatch: Colors.grey,
        appBarTheme: AppBarTheme(
          color: Colors.white,
        ),
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      builder: (context, child) {
        ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
          return buildError(context, errorDetails);
        };

        EasyLoading.init(); // does not work

        // ignore: close_sinks
        final ApplicationBloc _applicationBloc =
            BlocProvider.of<ApplicationBloc>(context);

        return Container(
          child: BlocProvider(
            create: (_) => _applicationBloc,
            child: BlocListener<ApplicationBloc, ApplicationState>(
              listener: _applicationBlocListener,
              child: BlocBuilder<ApplicationBloc, ApplicationState>(
                builder: (context, state) {
                  if (state is InitialApplicationState ||
                      state is ApplicationLoadingState) {
                    return LoadingWidget();
                  } else if (state is ApplicationLoadedState) {
                    return child;
                  } else {
                    return Text("Application load error. Try again.");
                  }
                },
              ),
            ),
          ),
        );
      },
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const <Locale>[
        const Locale('en', 'US'),
        const Locale('pl', 'PL'),
      ],
      routerDelegate: _appRouter.delegate(),
      routeInformationParser: _appRouter.defaultRouteParser(),
    );
  }

@nslogx
Copy link
Owner

nslogx commented Feb 10, 2021

EasyLoading.init()

@kokohuang how can I do that with more advanced builder configuration?

 @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      debugShowCheckedModeBanner: false,
      key: _navigatorKey,
      title: 'Title',
      theme: ThemeData(
        primarySwatch: Colors.grey,
        appBarTheme: AppBarTheme(
          color: Colors.white,
        ),
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      builder: (context, child) {
        ErrorWidget.builder = (FlutterErrorDetails errorDetails) {
          return buildError(context, errorDetails);
        };

        EasyLoading.init(); // does not work

        // ignore: close_sinks
        final ApplicationBloc _applicationBloc =
            BlocProvider.of<ApplicationBloc>(context);

        return Container(
          child: BlocProvider(
            create: (_) => _applicationBloc,
            child: BlocListener<ApplicationBloc, ApplicationState>(
              listener: _applicationBlocListener,
              child: BlocBuilder<ApplicationBloc, ApplicationState>(
                builder: (context, state) {
                  if (state is InitialApplicationState ||
                      state is ApplicationLoadingState) {
                    return LoadingWidget();
                  } else if (state is ApplicationLoadedState) {
                    return child;
                  } else {
                    return Text("Application load error. Try again.");
                  }
                },
              ),
            ),
          ),
        );
      },
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const <Locale>[
        const Locale('en', 'US'),
        const Locale('pl', 'PL'),
      ],
      routerDelegate: _appRouter.delegate(),
      routeInformationParser: _appRouter.defaultRouteParser(),
    );
  }

#83 (comment)

@kyadakrupali08
Copy link

I was got this errer Please help me ASAP

'package:flutter_easyloading/src/easy_loading.dart': Failed assertion: line 298 pos 7: '_getInstance().overlayEntry != null': overlayEntry should not be null

This is my Flutter Doctor details

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 1.25.0-8.2.pre, on Microsoft Windows [Version 10.0.14393], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.1.0)
[√] Connected device (1 available)

@nslogx
Copy link
Owner

nslogx commented Apr 14, 2021

@kyadakrupali08 you shuld init EasyLoading in you MaterialApp

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter EasyLoading',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter EasyLoading'),
      builder: EasyLoading.init(),
    );
  }
}

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

4 participants