scoped_listenable

Creator: coderz1093

Last updated:

0 purchases

scoped_listenable Image
scoped_listenable Images
Add to Cart

Description:

scoped listenable

Getting started #
Add scoped_listenable as a dependency in your pubspec.yaml file.
Usage #
Provide a Listenable to descendant widgets.
ScopedListenable(
listenable: counterModel,
child: MyApp(),
);
copied to clipboard
Observe changes in the Listenable provided by an ancestor widget.
ScopedBuilder<CounterModel>(
builder: (context, listenable, child) {
return Text('${listenable.counter}');
},
);
copied to clipboard
Advanced #
To add multiple ScopedListenables, use ScopedContainer.
ScopedContainer(
container: [
ScopedListenable.from(counterModel),
ScopedListenable.from(settingsModel),
],
child: MyApp(),
);
copied to clipboard
To obtain Listenable directly, use extension methods.
void initState() {
context.get<CounterModel>().reset();
copied to clipboard
Widget build(BuildContext context) {
final counterModel = context.watch<CounterModel>();
copied to clipboard
Additional information #
This is an updated version of scoped_model.

Credits to the original authors and maintainers of the package.

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.

Related Products

More From This Creator