dispose_scope 2.1.0 copy "dispose_scope: ^2.1.0" to clipboard
dispose_scope: ^2.1.0 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();
}
12
likes
160
pub points
76%
popularity

Publisher

verified publisherodrowaz.dev

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on dispose_scope