disposebag 1.0.0 copy "disposebag: ^1.0.0" to clipboard
disposebag: ^1.0.0 copied to clipboard

outdated

A package to help disposing Streams and closing Sinks.

disposebag #

Author: Petrus Nguyễn Thái Học #

Pub Build Status

A package to help disposing Streams and closing Sinks

Usage #

A simple usage example:

import 'package:disposebag/disposebag.dart';
import 'dart:async';

main() async {
  final controller1 = StreamController<int>();
  final controller2 = StreamController<int>();
  final periodict = Stream.periodic(
    const Duration(milliseconds: 100),
    (int i) => i,
  );

  // Create dispose bag with diposables list
  final bag = DisposeBag([
    controller1,
    controller2,
  ]);

  // Add single subscription
  bag.add(periodict.listen(controller1.add));

  // Add many 
  bag.addAll([
    controller1.stream.listen(print),
    controller2.stream.listen(print),
  ]);

  await bag.dispose();
  print("Bag disposed. It's all good");
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

19
likes
0
pub points
86%
popularity

Publisher

unverified uploader

A package to help disposing Streams and closing Sinks.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

meta

More

Packages that depend on disposebag