fluttercommunity / rx_command

RxCommand - Reactive event handler wrapper class inspired by ReactiveUI. Maintainer @escamoteur
https://pub.dev/packages/rx_command
MIT License
134 stars 19 forks source link

RxCommandListener error if only onIsBusy used #12

Closed hernan closed 5 years ago

hernan commented 5 years ago

I've a listener and only use onIsBusy and onError and see errors in the console about a call with null, traced the problem this piece

rx_command_listener.dart#56

      if (onIsBusy != null || onNotBusy != null) {
        busySubscription = command.isExecuting.listen((isBusy) {
          return isBusy ? this?.onIsBusy() : this.onNotBusy();
        });
      }

The problem disappear if use both parameters onIsBusy and onNotBusy

anaisbetts commented 5 years ago

Thanks for the catch, PR is up to fix it

escamoteur commented 5 years ago

Fixed in V4.3.0

kuhnroyal commented 5 years ago

Still having a problem in this line with the latest version if only onNotBusy is set.

I/flutter ( 8644): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter ( 8644): │ NoSuchMethodError: The method 'call' was called on null.
I/flutter ( 8644): │ Receiver: null
I/flutter ( 8644): │ Tried calling: call()
I/flutter ( 8644): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8644): │ #0   Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
I/flutter ( 8644): │ #1   new RxCommandListener.() (package:rx_command/rx_command_listener.dart:58:33)
I/flutter ( 8644): │ #2   _rootRunUnary (dart:async/zone.dart:1132:38)
I/flutter ( 8644): │ #3   _CustomZone.runUnary (dart:async/zone.dart:1029:19)
I/flutter ( 8644): │ #4   _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
I/flutter ( 8644): │ #5   _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
I/flutter ( 8644): │ #6   _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
I/flutter ( 8644): │ #7   _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11)
I/flutter ( 8644): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter ( 8644): │ ⛔ Uncaught error
I/flutter ( 8644): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    manager.registerCommandListener(RxCommandListener(
      manager.data,
      onNotBusy: () => refreshController.refreshCompleted(),
      onError: (_) => refreshController.refreshFailed(),
    ));
escamoteur commented 5 years ago

Could you please for now assign a dummy function? I look it it as soon as possible.