CaiJingLong / flutter_load_widget

Apache License 2.0
35 stars 13 forks source link

After the last update, I start noticing this issue #1

Closed SalehHub closed 5 years ago

SalehHub commented 5 years ago

Unhandled Exception: NoSuchMethodError: The method 'dismissAnim' was called on null. Receiver: null Tried calling: dismissAnim()

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)

1 LoadingDismissFuture.dismiss (package:load/src/dismiss_future.dart:26:29)

2 FutureManager.dismissAll. (package:load/src/dismiss_future.dart:45:9)

3 List.forEach (dart:core-patch/growable_array.dart:278:8)

4 FutureManager.dismissAll (package:load/src/dismiss_future.dart:44:22)

5 _LoadingProviderState._realDismissDialog (package:load/src/provider.dart:112:33)

6 _LoadingProviderState.dismissLoading (package:load/src/provider.dart:116:5)

7 hideLoadingDialog. (package:load/src/provider.dart:151:24)

8 new Future.delayed. (dart:async/future.dart:316:39)

9 _rootRun (dart:async/zone.dart:1120:38)

10 _CustomZone.run (dart:async/zone.dart:1021:19)

11 _CustomZone.<…>

CaiJingLong commented 5 years ago

https://github.com/CaiJingLong/flutter_load_widget#usage

image

CaiJingLong commented 5 years ago

And you maybe need click restart.

image

SalehHub commented 5 years ago

Thank you for your response, I was using 0.1.1 version just fine, after upgrading to the latest release I start noticing this issue, I moved back to 0.1.1 and everything working as it suppose to.

I will try to reproduce the issue with minimal code.

CaiJingLong commented 5 years ago

Okay, if you provide the minimum code that can be reproduced, I'll fix the problem as soon as possible.

kihonq commented 5 years ago

The issue still persist in the latest version.

CaiJingLong commented 5 years ago

@qeehong Provide a example. It is a repository or gist of runnable code.

kihonq commented 5 years ago

@CaiJingLong

main.dart:

@override
  Widget build(BuildContext context) {
    return LoadingProvider(
      themeData: LoadingThemeData(tapDismiss: false),
      loadingWidgetBuilder: (ctx, data) {
        return Center(
          child: SizedBox(
            width: 30,
            height: 30,
            child: Container(
              child: CupertinoActivityIndicator(),
              color: Colors.blue,
            ),
          ),
        );
      },
      child: ClientProvider(
        uri: MyConstant.gqlEndpoint,
        child: CacheProvider(
          child: MaterialApp(
            title: 'My App',
            theme: ThemeData(
              primarySwatch: Colors.yellow,
            ),
            home: setHomeNav(_firstInstall, _accessToken),
            debugShowCheckedModeBanner: false,
            routes: {
              '/home': (context) => HomePage(),
              '/login': (context) => LoginPage(),
              '/complaints': (context) => ComplaintsPage(),
              '/directory': (context) => DirectoriesPage(),
            },
          ),
        ),
      ),
    );
  }

home.dart:

void showAndDelayDismiss(
      [Duration duration = const Duration(seconds: 2)]) async {
    var future = await showLoadingDialog();
    Future.delayed(duration, () {
      future.dismiss();
    });
  }

Widget _helloBanner(BuildContext context) {
    return Query(
      options: QueryOptions(document: Queries.currentUser),
      builder: (QueryResult result, {VoidCallback refetch}) {
        if (result.errors != null) {
          showGqlErrorDialog(context, result.errors);
          return Center(child: Text(result.errors.toString()));
        }

        if (result.loading) {
          showAndDelayDismiss();
          return SizedBox.shrink();
        }
      },
    );
  }
kihonq commented 5 years ago

With version 0.1.1 I get this:

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method 'dismiss' was called on null.
Receiver: null
Tried calling: dismiss(true)
#0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:50:5)
#1      HomePageState.showAndDelayDismiss.<anonymous closure> 
package:pahang_go/pages/home_page.dart:54
#2      new Future.delayed.<anonymous closure>  (dart:async/future.dart:316:39)
#3      _rootRun  (dart:async/zone.dart:1120:38)
#4      _CustomZone.run  (dart:async/zone.dart:1021:19)
#5      _CustomZone.runGuarded  (dart:async/zone.dart:923:7)
#6      _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:963:23)
#7      _rootRun  (dart:async/zone.dart:1124:13)
#8      _CustomZone.run  (dart:async/zone.dart:1021:19)
#9      _CustomZone.bindCallback.<anonymous closure>  (dart:async/zone.dart:947:23)
#10     Timer._createTimer.<anonymous closure>  (dart:async-patch/timer_patch.dart:21:15)
#11     _Timer._runTimers  (dart:isolate-patch/timer_impl.dart:382:19)
#<…>

@salehahmedZ mind sharing your code here to get it working with v0.1.1 ?