dispose_scope 2.0.1 icon indicating copy to clipboard operation
dispose_scope: ^2.0.1 copied to clipboard

Simple package making it easy to dispose (aka cancel, aka close) your objects.

example/main.dart

import 'dart:async';

import 'package:dispose_scope/dispose_scope.dart';

void main() {
  final disposeScope = DisposeScope();

  // StreamSubscription will be cancelled when disposeScope is disposed
  const Stream<void>.empty().listen((dynamicevent) {}).disposedBy(disposeScope);

  // Timer will be cancelled when disposeScope is disposed
  Timer(Duration.zero, () {}).disposedBy(disposeScope);

  disposeScope.dispose();
}
6
likes
140
pub points
39%
popularity

Publisher

verified publisher iconodrowaz.dev

Simple package making it easy to dispose (aka cancel, aka close) your objects.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

meta

More

Packages that depend on dispose_scope