From 88f9903135bc1e44535857014bd4c805b7cf88d1 Mon Sep 17 00:00:00 2001 From: Kota Hayashi <90010509+K9i-0@users.noreply.github.com> Date: Mon, 13 Mar 2023 18:11:43 +0900 Subject: [PATCH] Update counter example (#2305) --- examples/counter/analysis_options.yaml | 5 +++++ examples/counter/lib/main.dart | 8 +------- 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 examples/counter/analysis_options.yaml diff --git a/examples/counter/analysis_options.yaml b/examples/counter/analysis_options.yaml new file mode 100644 index 000000000..d05ba1fc4 --- /dev/null +++ b/examples/counter/analysis_options.yaml @@ -0,0 +1,5 @@ +include: ../analysis_options.yaml +# enable riverpod_lint +analyzer: + plugins: + - custom_lint \ No newline at end of file diff --git a/examples/counter/lib/main.dart b/examples/counter/lib/main.dart index d6209953c..da3b7410e 100644 --- a/examples/counter/lib/main.dart +++ b/examples/counter/lib/main.dart @@ -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