easy_dispose_rxdart 1.0.1
easy_dispose_rxdart: ^1.0.1 copied to clipboard

Extension to easy_dispose package. Help dispose rxdart classes like Subject.

Pub

Add disposable feature to rxdart classes. Read easy_dispose documentation for details.

You can find all available extensions in easy_dispose repository.

Supported features #

  • SubjectDisposable

Example #

import 'dart:async';

import 'package:easy_dispose/easy_dispose.dart';
import 'package:rxdart/rxdart.dart';

// ignore_for_file: no-empty-block, avoid_print
Future main() async {
  final myDisposableOwner = MyDisposableOwner();

  // do something

  await myDisposableOwner.dispose();
}

class MyDisposableOwner extends DisposableOwner {
  final Subject subject = BehaviorSubject();

  MyDisposableOwner()
      : super(
          disposeOrder: DisposeOrder.lifo,
        ) {
    addCustomDisposable(() => print('Final dispose'));
    subject.disposeWith(this);

    subject.stream
        .listen(
          (_) {},
        )
        .disposeWith(this);
    addCustomDisposable(() => print('First dispose'));
  }
}


0
likes
130
pub points
48%
popularity

Extension to easy_dispose package. Help dispose rxdart classes like Subject.

Repository (GitHub)
View/report issues

Documentation

API reference

License

AGPL 3.0 (LICENSE)

Dependencies

easy_dispose, rxdart

More

Packages that depend on easy_dispose_rxdart