Skip to content

Instantly share code, notes, and snippets.

@marcossevilla
Created February 17, 2021 16:40
Show Gist options
  • Save marcossevilla/8f61dbd48b0133977f77d3059b43ee5a to your computer and use it in GitHub Desktop.
Save marcossevilla/8f61dbd48b0133977f77d3059b43ee5a to your computer and use it in GitHub Desktop.
class WidgetToShowNames extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer(
builder: (_, watch, __) {
final List<String> names = watch(namesNotifier).state;
return ListView.builder(
itemCount: names.length,
itemBuilder: (_, index) {
final name = names[index];
return Text(name);
}
);
},
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment