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

outdated

A package to help disposing Streams and closing Sinks.

A library for Dart developers.

Created from templates made available by Stagehand under a BSD-style license.

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
30
pub points
86%
popularity

Publisher

unverified uploader

A package to help disposing Streams and closing Sinks.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on disposebag