wrap_with_listenable_builder
Wrap the selected widget with a ListenableBuilder
.
Before
Widget build(BuildContext context) {
return Text('${counterNotifier.count}');
// ^^^^
}
After
Widget build(BuildContext context) {
return ListenableBuilder(
listenable: counterNotifier,
builder: (context, child) {
return Text('${counterNotifier.count}');
},
);
}