Skip to content

Commit

Permalink
Update counter example (#2305)
Browse files Browse the repository at this point in the history
  • Loading branch information
K9i-0 authored Mar 13, 2023
1 parent 6031730 commit 88f9903
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 5 additions & 0 deletions examples/counter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: ../analysis_options.yaml
# enable riverpod_lint
analyzer:
plugins:
- custom_lint
8 changes: 1 addition & 7 deletions examples/counter/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ class Home extends ConsumerWidget {
return Scaffold(
appBar: AppBar(title: const Text('Counter example')),
body: Center(
// Consumer is a widget that allows you reading providers.
child: Consumer(
builder: (context, ref, _) {
final count = ref.watch(counterProvider);
return Text('$count');
},
),
child: Text('${ref.watch(counterProvider)}'),
),
floatingActionButton: FloatingActionButton(
// The read method is a utility to read a provider without listening to it
Expand Down

0 comments on commit 88f9903

Please sign in to comment.