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

NoSuchMethodError: The method 'call' was called on null #31

Closed
boozy-ph opened this issue Nov 20, 2019 · 4 comments
Closed

NoSuchMethodError: The method 'call' was called on null #31

boozy-ph opened this issue Nov 20, 2019 · 4 comments

Comments

@boozy-ph
Copy link

What's the fix for this issue?

E/flutter ( 8587): [ERROR:flutter/lib/ui/ui_dart_state.cc(144)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
E/flutter ( 8587): Receiver: null
E/flutter ( 8587): Tried calling: call()
�[38;5;244mE/flutter ( 8587): #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:51:5)�[39;49m
�[38;5;248mE/flutter ( 8587): #1      new RxCommandListener.<anonymous closure>�[39;49m
�[38;5;244mE/flutter ( 8587): #2      _rootRunUnary  (dart:async/zone.dart:1132:38)�[39;49m
�[38;5;244mE/flutter ( 8587): #3      _CustomZone.runUnary  (dart:async/zone.dart:1029:19)�[39;49m
�[38;5;244mE/flutter ( 8587): #4      _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)�[39;49m
�[38;5;244mE/flutter ( 8587): #5      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:336:11)�[39;49m
�[38;5;244mE/flutter ( 8587): #6      _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:263:7)�[39;49m
�[38;5;244mE/flutter ( 8587): #7      _ForwardingStreamSubscription._add  (dart:async/stream_pipe.dart:132:11)�[39;49m
�[38;5;244mE/flutter ( 8587): #8      _DistinctStream._handleData  (dart:async/stream_pipe.dart:480:12)�[39;49m
�[38;5;244mE/flutter ( 8587): #9      _ForwardingStreamSubscription._handleData  (dart:async/stream_pipe.dart:164:13)�[39;49m
�[38;5;244mE/flutter ( 8587): #10     _rootRunUnary  (dart:async/zone.dart:1132:38)�[39;49m
�[38;5;244mE/flutter ( 8587): #11     _CustomZone.runUnary  (dart:async/zone.dart:1029:19)�[39;49m
�[38;5;244mE/flutter ( 8587): #12     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)�[39;49m
�[38;5;244mE/flutter ( 8587): #13     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:336:11)�[39;49m
�[38;5;244mE/flutter ( 8587): #14     _DelayedData.perform  (dart:async/stream_impl.dart:591:14)�[39;49m
�[38;5;244mE/flutter ( 8587): #15     _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:707:11)�[39;49m
�[38;5;244mE/flutter ( 8587): #16     _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:667:7)�[39;49m
�[38;5;244mE/flutter ( 8587): #17     _rootRun  (dart:async/zone.dart:1120:38)�[39;49m
�[38;5;244mE/flutter ( 8587): #18     _CustomZone.run  (dart:async/zone.dart:1021:19)�[39;49m
�[38;5;244mE/flutter ( 8587): #19     _CustomZone.runGuarded  (dart:async/zone.dart:923:7)�[39;49m
�[38;5;244mE/flutter ( 8587): #20     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:963:23)�[39;49m
�[38;5;244mE/flutter ( 8587): #21     _rootRun  (dart:async/zone.dart:1124:13)�[39;49m
�[38;5;244mE/flutter ( 8587): #22     _CustomZone.run  (dart:async/zone.dart:1021:19)�[39;49m
�[38;5;244mE/flutter ( 8587): #23     _CustomZone.runGuarded  (dart:async/zone.dart:923:7)�[39;49m
�[38;5;244mE/flutter ( 8587): #24     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:963:23)�[39;49m
�[38;5;244mE/flutter ( 8587): #25     _microtaskLoop  (dart:async/schedule_microtask.dart:41:21)�[39;49m
�[38;5;244mE/flutter ( 8587): #26     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:50:5)�[39;49m

This is about RxCommandListener that was called on widget initState.

_searchLocationCommandListener = RxCommandListener(
          sl<LocationsManager>().updateLocationsCommand, onIsBusy: () {
        setState(() {
          _stackToView = 3;
        });
      }, onResult: (result) {
        if (result.hasData) {
          setState(() {
            _data = result.data;

            if (_data.isNotEmpty) {
              _stackToView = 1;
            } else {
              _stackToView = 2;
            }
          });
        }
      }, onError: (error) {
        print('error $error');
      });
@escamoteur
Copy link
Collaborator

Hmm,
the message looks like your RxCommand was null when you tried to call it but the stacktrace has the RxCommandListener somehow in it.
Could you activate 'Break on all Exceptions in your debugger' and try to figure out where it exactly happens?

@freeman29
Copy link

This happens on widget initialisation state, and I manage to fix the error by adding the following code/method on RxCommandListener:

onNotBusy: () {
   print('onNotBusy');
}

@escamoteur can you please explain why? was onNotBusy a required one?

@escamoteur
Copy link
Collaborator

It's a bug. The moment you set onBusy() it required also onNonBusy. I'm just fixing it

@escamoteur
Copy link
Collaborator

Fixed in V4.3.3

Was a bug that only could happen if you only set one of the busy handlers.

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

3 participants