easy_dispose_rxdart 1.1.0 copy "easy_dispose_rxdart: ^1.1.0" to clipboard
easy_dispose_rxdart: ^1.1.0 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
160
pub points
62%
popularity

Publisher

unverified uploader

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