mpv 0.1.0+2 copy "mpv: ^0.1.0+2" to clipboard
mpv: ^0.1.0+2 copied to clipboard

discontinued

mpv like mvp, but for flutter, and has mechanism for unsubscribing from the result from future or stream

MVP #

As in MVP there is Presenter and View

Example #

Presenter implements logic and returns the result through subject

    class SamplePresenter extends Presenter<SampleView> {
    
      SamplePresenter(SampleView view) : super(view) {
        view.counter.add(CounterState(count));
      }
    }
    
    mixin SampleView implements View {
      final counter = BehaviorSubject<CounterState>();
    
      @override
      close() {
        counter.close();
      }
    }

state implements view and has presenter

    class _SampleWidgetState
        extends StateWithPresenter<SampleWidget, SamplePresenter> with SampleView {
      @override
      SamplePresenter createPresenter() {
        return SamplePresenter(this);
      }
    }

There is also a mechanism for unsubscribing from the result from future or stream

Example Cancelable #

    Future future;
    CancelableFuture cancelableFuture = CancelableFuture(future);
    cancelableFuture.then((value) {
      print(value);
    });
    cancelableFuture.cancelable.cancel();

The presenter has futures in map, that will be canceled if the view is closed or if future with the same key

You can add your requests in this map using the method cancelable

    cancelable(cancelKey,Future.delayed(Duration(seconds: 1)))
    .then((_) {})
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

mpv like mvp, but for flutter, and has mechanism for unsubscribing from the result from future or stream

Repository (GitLab)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on mpv