flutter_dispose_scope

Last updated:

0 purchases

flutter_dispose_scope Image
flutter_dispose_scope Images
Add to Cart

Description:

flutter dispose scope

BlocDisposeScope #
BlocDisposeScope adds support for flutter related types to dispose_scope package.
Usage #
import 'package:flutter_dispose_scope/flutter_dispose_scope.dart';

class App extends StatefulWidget {
const App({Key? key}) : super(key: key);

@override
_AppState createState() => _AppState();
}

class _AppState extends State<App> with StateDisposeScopeMixin {
@override
void initState() {
super.initState();

// StreamSubscription will be cancelled when widget is disposed
const Stream.empty().listen((event) {}).disposedBy(scope);

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

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: SizedBox(),
);
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.