easy_dispose_rxdart 1.1.0 easy_dispose_rxdart: ^1.1.0 copied to clipboard
Extension to easy_dispose package. Help dispose rxdart classes like Subject.
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'));
}
}