builderchildbuild createState createElementrefcontext container _dependencies_oldDependencies _listeners_manualListeners_tickerModeNotifier _isActivemountactivate_applyTickerMode_updateTickerModeNotifier_updateTickerModedidChangeDependencies_assertNotDisposedwatchunmountlistenexistsreadrefresh invalidate listenManualConsumerBuilderConsumerConsumerWidget_ConsumerStateConsumerStatefulWidget ConsumerStateConsumerStatefulElementLinternalWidget BuildContext WidgetRef TickerModeofProviderSubscriptionpausekeyoverrideStatelessWidgetStatefulWidgetInheritedWidget canUpdate"dependOnInheritedWidgetOfExactTypewidgetbuildrefStatecontextElementStatefulElementProviderContainer ProviderScope containerOflistenProviderListenableObjectMapListValueListenableboolvoidmountactivate getNotifierremoveListener addListenervaluevaluessubresumedidChangeDependencies dependencycloseclearilengthdepmounted StateError putIfAbsentremovemarkNeedsBuildreadSafevalueOrProviderExceptionunmounttoListlistener StackTracedebugDoingBuildonErrorweakadd ProviderBaseexistsread RefreshablerefreshProviderOrFamily invalidateasReloadfireImmediatelyimplonClosecallConsumerWidgetConsumerStatefulWidget ConsumerStateStatefulWidgetStateStatefulElement WidgetRefàN5æ¸Izf�‚I6©–M µ]ÀKö‚gJNfp€Š€Ó€Ô€ö�,�0�~�›�Ÿ�¼�À�Ì�Ú‚‚‚‚!‚%‚`‚d‚p‚›‚«‚å‚þƒ,ƒ]ƒ—ƒÏƒü„„„„„"„o„§……H…�…Ñ…Õ†††G†W†‚†›†É†â‡‡D‡‚‡¾‡ï‡ÿˆˆˆ"ˆ(ˆ0ˆ4ˆVˆZˆ£ˆí‰ ‰$‰b‰ª‰®‰¼‰ÀŠŠdГЦлŠé‹ ‹L‹M‹‘‹—‹ð‹öŒŒMŒ[ŒkŒ”ŒÅŒû� ���'�-�E�f�g�´�Ý�ãŽ3Žޭ޳Žù�?�i�o�¶�� �C�I�W�¢�Î�à�ú‘‘%‘-‘3‘c‘ª‘Ƒ̑ޒ’5’Q’r’�’›’¸’õ““`“|“Д$”I”‰”�”±”û•'•Q•s•Ž•§•¾– –Y–~–¬–À–Ó–ä–ó—+—V—¥—´—Á—Ë—Ó—Ý—ô—õ˜˜7˜`˜d˜f˜g˜�˜Ø˜Ü™,™l™p™¶™º™Ü™à™ìš+š3š7šŒš�šœšÇšùšý› ›G›|›§›¯›µ›½›Á›Îœœœ!œ/œgœ”œÆœïœõœý���O�Ÿ�³�Æ�ÛžžBžgžhž³ž¹Ÿ ŸZŸ¥Ÿø   & q ¾¡¡X¡”¡š¡ê¢8¢]¢c¢±¢ú£G£�£Û¤¤$¤a¤g¤µ¤Á¤ý¥8¥>¥†¥¦¥¬¥¼¥Â¦¦P¦Q¦]¦Ž¦Â¦Ä¦Å§§§R§T§U§‡§Ï§Ó¨"¨A¨E¨Q¨‡¨»¨¿¨Ï©©©©]©m©†©³©Î©Ö©Ú©êªªgªˆª�ª–ªžª±ªÆ««6«c«d«p«�«�«œ«è«ê«ë¬¬¬l¬”¬˜¬Ý¬á¬í­#­W­[­k­°­¶­º­ù® ®"®O®j®r®v®†®±¯¯$¯,¯2¯:¯O¯”¯±¯Ü°°°°9°C°~°™°Ì± ± ±±=±>±J±Š±”±§±¬±Â²²K²_²—²Ð²þ³³³³O³q³{³Î³ý´$´6´‹´‘´•´–´¢´¶´Ì´í´ñ´òµ&µOµSµTµyµ¼µ½µõ¶3¶o¶¢¶½¶Ã¶Ç¶È¶å··7·S·ƒ·›·³·Ä·Û·å·í·ó·÷·ø¸¸%¸H¸‚¸§¸Ç¸þ¹¹"¹?¹E¹I¹J¹V¹i¹�¹³¹¹¹º¹Ä¹ìº º?ºGºaº{º—º§ºÛºðºø»»»!»"»@»\»t»Ç¼1¼¶¼¿¼Å¼É¼Ê¼Ö½½,½E½k½±½²½Ý¾¾¾¾H¾`¾Œ¾�¾Â¾Ü¾ë¿¿)¿<¿@¿A¿M¿`¿œ¿�¿Ò¿ì¿òÀ@$À@AÀ@GÀ@HÀ@~À@ˆÀ@ÍÀAÀA0ÀA@ÀAzÀAŸÀAÑÀAíÀA÷ÀBÀB ÀB&ÀB*ÀB+ÀB7ÀBNÀBwÀBµÀBöÀC ÀCÀC.ÀC:ÀCQÀC¢ÀC©ÀCªÀCôÀDCÀDvÀD ÀD°ÀDÀÀDØÀDêÀDñÀE ÀEÀEÀEÀEKÀEeÀE±ÀEµÀE¶ÀEÂÀEÿÀFÀFcÀFgÀFhÀFtÀF­ÀFÇÀGÀGÀGÀG%ÀGmÀG‡ÀG¿ÀGÃÀGÄÀGÐÀHÀH.ÀHkÀH¬ÀHÎÀHåÀHìÀIÀI5ÀI6ÀIƒÀI¤ÀIêÀIëÀJÀJ%ÀJ5ÀJMÀJuÀJ‡ÀJŽÀJ�ÀJÀÀJîÀK ÀK)ÀKxÀKšÀK¿ÀKÆÀKÇÀKßÀKàÀKðÀKôÀKö‹‹‹‹ ‹"‹'‹'‹5‹>‹> ‹CŠëŠë`/// {@macro riverpod.consumer}�]‹O‚�]�Õ/// The builder that will be called when the provider is updated. /// /// The `child` parameter will be the same as [child] if specified, or null otherwise. /// /// **Note** /// You can watch as many providers inside [Consumer] as you want to: /// ```dart /// Consumer( /// builder: (context, ref, child) { /// final value = ref.watch(someProvider); /// final another = ref.watch(anotherProvider); /// ... /// }, /// ); /// ``` /// /// See also [child].—í�iЉ—í‰é/// The [child] parameter is an optional parameter for the sole purpose of /// further performance optimizations. /// /// If your `builder` function contains a subtree that does not depend on the /// animation, it is more efficient to build that subtree once instead of /// rebuilding it on every provider update. /// /// If you pass the pre-built subtree as the `child` parameter, the /// Consumer will pass it back to your builder function so that you /// can incorporate it into your build. /// /// Using this pre-built child is entirely optional, but can improve /// performance significantly in some cases and is therefore a good practice. /// /// This sample shows how you could use a [Consumer] /// /// ```dart /// final counterProvider = NotifierProvider(Counter.new); /// class Counter extends Notifier { /// @override /// int build() => 0; /// /// void increment() => state++; /// } /// /// class MyHomePage extends ConsumerWidget { /// MyHomePage({Key? key, required this.title}) : super(key: key); /// final String title; /// /// @override /// Widget build(BuildContext context, WidgetRef ref) { /// return Scaffold( /// appBar: AppBar( /// title: Text(title) /// ), /// body: Center( /// child: Column( /// mainAxisAlignment: MainAxisAlignment.center, /// children: [ /// Text('You have pushed the button this many times:'), /// Consumer( /// builder: (BuildContext context, WidgetRef ref, Widget? child) { /// // This builder will only get called when the counterProvider /// // is updated. /// final count = ref.watch(counterProvider); /// /// return Row( /// mainAxisAlignment: MainAxisAlignment.spaceEvenly, /// children: [ /// Text('$count'), /// child!, /// ], /// ); /// }, /// // The child parameter is most helpful if the child is /// // expensive to build and does not depend on the value from /// // the notifier. /// child: Text('Good job!'), /// ) /// ], /// ), /// ), /// floatingActionButton: FloatingActionButton( /// child: Icon(Icons.plus_one), /// onPressed: () => ref.read(counterProvider.notifier).increment(), /// ), /// ); /// } /// } /// ```˜˜˜˜&˜& ˜0—÷—ø—÷—÷l˜ €Ô€Ô—‘ŠÇ‰æ/// {@template riverpod.consumer} /// Build a widget tree while listening to providers. /// /// [Consumer]'s main use-case is for reducing the number of rebuilt widgets. /// when a provider changes. /// /// As an example, consider: /// /// ```dart /// @riverpod /// Future fetchUser(Ref ref) async { /// // ... /// } /// ``` /// /// Normally, we would use a [ConsumerWidget] as followed: /// /// ```dart /// class Example extends ConsumerWidget { /// @override /// Widget build(BuildContext context, WidgetRef ref) { /// return Scaffold( /// appBar: AppBar(title: Text('User')), /// body: switch (ref.watch(userProvider) { /// AsyncValue(:final value?) => Text(value.name), /// AsyncValue(hasError: true) => Text('Error'), /// _ => CircularProgressIndicator(), /// }, /// } /// } /// ``` /// /// However, this would rebuild the entire `Scaffold` when the user changes. /// If we are looking to reduce this, have two options: /// - Extract the `body` into a separate [ConsumerWidget]. Then only the `body` will rebuild. /// This is the recommended approach, but is a bit more verbose. /// - Use [Consumer] to only rebuild the `body` when the user changes. /// This is less recommended, but avoids creating a new widget. /// /// Using [Consumer], the resulting code would look like: /// ```dart /// class Example extends StatelessWidget { /// @override /// Widget build(BuildContext context) { /// return Scaffold( /// appBar: AppBar(title: Text('User')), /// body: Consumer( /// builder: (context, ref, child) { /// return switch (ref.watch(userProvider) { /// AsyncValue(:final value?) => Text(value.name), /// AsyncValue(hasError: true) => Text('Error'), /// _ => CircularProgressIndicator(), /// }; /// }), /// ); /// } /// } /// ``` /// /// ## Performance considerations /// /// To optimize performance by avoiding unnecessary network requests and /// pausing unused streams, [Consumer] will temporarily stop listening to /// providers when the widget stops being visible. /// /// This is determined using [TickerMode.of], and will invoke /// [ProviderSubscription.pause] on all currently active subscriptions. /// /// See also: /// /// - [ConsumerWidget], a base-class for widgets that wants to listen to providers. /// - [child], a way to optimize the widget tree by passing a child widget that /// won't rebuild when the provider changes. /// {@endtemplate} /// {@category Core}žJžXžZžZ ž`žžJ%/// {@macro riverpod.consumer_widget}¦*¦*¦7¦@¦@ ¦Jžjžj‡å¦$‡f/// Describes the part of the user interface represented by this widget. /// /// The framework calls this method when this widget is inserted into the tree /// in a given [BuildContext] and when the dependencies of this widget change /// (e.g., an [InheritedWidget] referenced by this widget changes). This /// method can potentially be called in every frame and should not have any side /// effects beyond building a widget. /// /// The framework replaces the subtree below this widget with the widget /// returned by this method, either by updating the existing subtree or by /// removing the subtree and inflating a new subtree, depending on whether the /// widget returned by this method can update the root of the existing /// subtree, as determined by calling [Widget.canUpdate]. /// /// Typically implementations return a newly created constellation of widgets /// that are configured with information from this widget's constructor and /// from the given [BuildContext]. /// /// The given [BuildContext] contains information about the location in the /// tree at which this widget is being built. For example, the context /// provides the set of inherited widgets for this location in the tree. A /// given widget might be built with multiple different [BuildContext] /// arguments over time if the widget is moved around the tree or if the /// widget is inserted into the tree in multiple places at once. /// /// The implementation of this method must only depend on: /// /// * the fields of the widget, which themselves must not change over time, /// and /// * any ambient state obtained from the `context` using /// [BuildContext.dependOnInheritedWidgetOfExactType]. /// /// If a widget's [build] method is to depend on anything else, use a /// [StatefulWidget] instead. /// /// See also: /// /// * [StatelessWidget], which contains the discussion on performance considerations.¦S¦T¦S¦Sn¦Ÿ˜g˜gŽ\�ê…s/// {@template riverpod.consumer_widget} /// The equivalent of a [StatelessWidget] that can listen to providers. /// /// Using [ConsumerWidget], this allows the widget tree to listen to changes on /// provider, so that the UI automatically updates when needed. /// /// Do not modify any state or start any http request inside [build]. /// /// As a usage example, consider: /// /// ```dart /// final helloWorldProvider = Provider((_) => 'Hello world'); /// ``` /// /// We can then subclass [ConsumerWidget] to listen to `helloWorldProvider` like so: /// /// ```dart /// class Example extends ConsumerWidget { /// const Example({Key? key}): super(key: key); /// /// @override /// Widget build(BuildContext context, WidgetRef ref) { /// final value = ref.watch(helloWorldProvider); /// return Text(value); // Hello world /// } /// } /// ``` /// /// **Note** /// You can watch as many providers inside [build] as you want to: /// /// ```dart /// @override /// Widget build(BuildContext context, WidgetRef ref) { /// final value = ref.watch(someProvider); /// final another = ref.watch(anotherProvider); /// return Text(value); // Hello world /// } /// ``` /// /// See also: /// - [ConsumerStatefulWidget], for a [StatefulWidget] variant. /// - [Consumer], to help reducing the number of rebuilt widgets without making /// a new widget. /// {@endtemplate} /// {@category Core}§§§*§§§§M§¦Å¦Å€Ž¦Ë«>«T«V«V «\««[./// {@macro riverpod.consumer_stateful_widget}«f«g«f«f(«€«’«“«’«’U«¶§U§U„”ªÕƒp/// {@template riverpod.consumer_stateful_widget} /// A [StatefulWidget] that has a [State] capable of reading providers. /// /// This is used exactly like a [StatefulWidget], but with a [State] that must /// subclass [ConsumerState] : /// /// ```dart /// class MyConsumer extends ConsumerStatefulWidget { /// const MyConsumer({Key? key}): super(key: key); /// /// @override /// ConsumerState createState() => _MyConsumerState(); /// } /// /// class _MyConsumerState extends ConsumerState { /// @override /// void initState() { /// // All State life-cycles can be used /// super.initState(); /// } /// /// @override /// Widget build(BuildContext context) { /// // "ref" is a property of ConsumerState and can be used to read providers /// ref.watch(someProvider); /// } /// } /// ``` /// {@endtemplate} /// {@category Core}¯l¯l&¯l¯÷¯ï¯ú¯é¯³P¯é(/// {@macro flutter_riverpod.widget_ref}«ë«ë„¯^ƒc/// The [State] for a [ConsumerStatefulWidget]. /// /// It has all the life-cycles if a normal [State], with the only difference /// being that it has a [ref] property. /// /// It must be used in conjunction with a [ConsumerStatefulWidget] : /// /// ```dart /// class MyConsumer extends ConsumerStatefulWidget { /// const MyConsumer({Key? key}): super(key: key); /// /// @override /// ConsumerState createState() => _MyConsumerState(); /// } /// /// class _MyConsumerState extends ConsumerState { /// @override /// void initState() { /// // All State life-cycles can be used /// super.initState(); /// } /// /// @override /// Widget build(BuildContext context) { /// // "ref" is a property of ConsumerState and can be used to read providers /// ref.watch(someProvider); /// } /// } /// ``` /// {@category Core}°Î°å°æ°æ#±°›°›p0/// The [Element] for a [ConsumerStatefulWidget] ±@±A±o±|±}±ˆ±©±Ž±˜±ž± ±c±@j±c²²±È²±É±Û±ã±Ü±â±æ±ú²±û²±²±®X±²²M² S²M ²“²”²t²’²u²‰²‘²Š²�²g²a4²g²¾²™5²¾²é²Ò*²é³³³±±±±-±,³+³+³4³<³<³D³³³³�€³%´˜´™´˜´˜X´©µ µ µ´ô´ô^´ùµVµV�pµ[¶Ê¶Ê�,¶Ï·ú·û·ú·ú�N¸ ¹L¹M¹L¹L�Ô¹_»$»$�¤»)¼å¼å¼å¼í¼í!½¼Ì¼Í¼Ì¼Ì‚s¼ß¿C¿D¿C¿C‚æ¿TÀBEÀBEÀBEÀBRÀBR#ÀBmÀB{ÀB{6ÀB©ÀB¹ÀB¹;ÀBíÀBúÀBúÀBÿÀB-ÀB.ÀCÀB-ÀB-‚àÀB>ÀE)ÀE)ÀE?ÀEÀEÀEÀE€£ÀE"ÀEÐÀEÐÀEÐÀEØÀEØ#ÀEóÀE¸ÀE¹ÀE¸ÀE¸€®ÀEËÀF…ÀF…ÀF…ÀF�ÀF�ÀF¡ÀFjÀFkÀFjÀFj€­ÀF}ÀG7ÀG7ÀGHÀGSÀGSÀGXÀGÀGÀGcÀGÀG€§ÀG,ÀGüÀGüÀGüÀH ÀH #ÀH$ÀH2ÀH25ÀH_ÀHoÀHo;ÀH£ÀH°ÀH°ÀHµÀHÒÀHÒÀH×ÀGÆÀGÇÀHÇÀHÞÀGÆÀGÆ„-ÀGï°9°:°°›í°N0/// The [Element] for a [ConsumerStatefulWidget]fg€¹xL/// A function that can also listen to providers /// /// See also [Consumer]‚gJNfp€Š€Ó€Ô€ö�,�0�~�›�Ÿ�¼�À�Ì�Ú‚‚‚‚!‚%‚`‚d‚p‚›‚«‚å‚þƒ,ƒ]ƒ—ƒÏƒü„„„„„"„o„§……H…�…Ñ…Õ†††G†W†‚†›†É†â‡‡D‡‚‡¾‡ï‡ÿˆˆˆ"ˆ(ˆ0ˆ4ˆVˆZˆ£ˆí‰ ‰$‰b‰ª‰®‰¼‰ÀŠŠdГЦлŠé‹ ‹L‹M‹‘‹—‹ð‹öŒŒMŒ[ŒkŒ”ŒÅŒû� ���'�-�E�f�g�´�Ý�ãŽ3Žޭ޳Žù�?�i�o�¶�� �C�I�W�¢�Î�à�ú‘‘%‘-‘3‘c‘ª‘Ƒ̑ޒ’5’Q’r’�’›’¸’õ““`“|“Д$”I”‰”�”±”û•'•Q•s•Ž•§•¾– –Y–~–¬–À–Ó–ä–ó—+—V—¥—´—Á—Ë—Ó—Ý—ô—õ˜˜7˜`˜d˜f˜g˜�˜Ø˜Ü™,™l™p™¶™º™Ü™à™ìš+š3š7šŒš�šœšÇšùšý› ›G›|›§›¯›µ›½›Á›Îœœœ!œ/œgœ”œÆœïœõœý���O�Ÿ�³�Æ�ÛžžBžgžhž³ž¹Ÿ ŸZŸ¥Ÿø   & q ¾¡¡X¡”¡š¡ê¢8¢]¢c¢±¢ú£G£�£Û¤¤$¤a¤g¤µ¤Á¤ý¥8¥>¥†¥¦¥¬¥¼¥Â¦¦P¦Q¦]¦Ž¦Â¦Ä¦Å§§§R§T§U§‡§Ï§Ó¨"¨A¨E¨Q¨‡¨»¨¿¨Ï©©©©]©m©†©³©Î©Ö©Ú©êªªgªˆª�ª–ªžª±ªÆ««6«c«d«p«�«�«œ«è«ê«ë¬¬¬l¬”¬˜¬Ý¬á¬í­#­W­[­k­°­¶­º­ù® ®"®O®j®r®v®†®±¯¯$¯,¯2¯:¯O¯”¯±¯Ü°°°°9°C°~°™°Ì± ± ±±=±>±J±Š±”±§±¬±Â²²K²_²—²Ð²þ³³³³O³q³{³Î³ý´$´6´‹´‘´•´–´¢´¶´Ì´í´ñ´òµ&µOµSµTµyµ¼µ½µõ¶3¶o¶¢¶½¶Ã¶Ç¶È¶å··7·S·ƒ·›·³·Ä·Û·å·í·ó·÷·ø¸¸%¸H¸‚¸§¸Ç¸þ¹¹"¹?¹E¹I¹J¹V¹i¹�¹³¹¹¹º¹Ä¹ìº º?ºGºaº{º—º§ºÛºðºø»»»!»"»@»\»t»Ç¼1¼¶¼¿¼Å¼É¼Ê¼Ö½½,½E½k½±½²½Ý¾¾¾¾H¾`¾Œ¾�¾Â¾Ü¾ë¿¿)¿<¿@¿A¿M¿`¿œ¿�¿Ò¿ì¿òÀ@$À@AÀ@GÀ@HÀ@~À@ˆÀ@ÍÀAÀA0ÀA@ÀAzÀAŸÀAÑÀAíÀA÷ÀBÀB ÀB&ÀB*ÀB+ÀB7ÀBNÀBwÀBµÀBöÀC ÀCÀC.ÀC:ÀCQÀC¢ÀC©ÀCªÀCôÀDCÀDvÀD ÀD°ÀDÀÀDØÀDêÀDñÀE ÀEÀEÀEÀEKÀEeÀE±ÀEµÀE¶ÀEÂÀEÿÀFÀFcÀFgÀFhÀFtÀF­ÀFÇÀGÀGÀGÀG%ÀGmÀG‡ÀG¿ÀGÃÀGÄÀGÐÀHÀH.ÀHkÀH¬ÀHÎÀHåÀHìÀIÀI5ÀI6ÀIƒÀI¤ÀIêÀIëÀJÀJ%ÀJ5ÀJMÀJuÀJ‡ÀJŽÀJ�ÀJÀÀJîÀK ÀK)ÀKxÀKšÀK¿ÀKÆÀKÇÀKßÀKàÀKðÀKôÀKö ../core.dartConsumerConsumerWidget_ConsumerStateConsumerStatefulWidget ConsumerStateConsumerStatefulElementriverpod.consumerˆˆBuild a widget tree while listening to providers. [Consumer]'s main use-case is for reducing the number of rebuilt widgets. when a provider changes. As an example, consider: ```dart @riverpod Future fetchUser(Ref ref) async { // ... } ``` Normally, we would use a [ConsumerWidget] as followed: ```dart class Example extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return Scaffold( appBar: AppBar(title: Text('User')), body: switch (ref.watch(userProvider) { AsyncValue(:final value?) => Text(value.name), AsyncValue(hasError: true) => Text('Error'), _ => CircularProgressIndicator(), }, } } ``` However, this would rebuild the entire `Scaffold` when the user changes. If we are looking to reduce this, have two options: - Extract the `body` into a separate [ConsumerWidget]. Then only the `body` will rebuild. This is the recommended approach, but is a bit more verbose. - Use [Consumer] to only rebuild the `body` when the user changes. This is less recommended, but avoids creating a new widget. Using [Consumer], the resulting code would look like: ```dart class Example extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('User')), body: Consumer( builder: (context, ref, child) { return switch (ref.watch(userProvider) { AsyncValue(:final value?) => Text(value.name), AsyncValue(hasError: true) => Text('Error'), _ => CircularProgressIndicator(), }; }), ); } } ``` ## Performance considerations To optimize performance by avoiding unnecessary network requests and pausing unused streams, [Consumer] will temporarily stop listening to providers when the widget stops being visible. This is determined using [TickerMode.of], and will invoke [ProviderSubscription.pause] on all currently active subscriptions. See also: - [ConsumerWidget], a base-class for widgets that wants to listen to providers. - [child], a way to optimize the widget tree by passing a child widget that won't rebuild when the provider changes.riverpod.consumer_widget„€The equivalent of a [StatelessWidget] that can listen to providers. Using [ConsumerWidget], this allows the widget tree to listen to changes on provider, so that the UI automatically updates when needed. Do not modify any state or start any http request inside [build]. As a usage example, consider: ```dart final helloWorldProvider = Provider((_) => 'Hello world'); ``` We can then subclass [ConsumerWidget] to listen to `helloWorldProvider` like so: ```dart class Example extends ConsumerWidget { const Example({Key? key}): super(key: key); @override Widget build(BuildContext context, WidgetRef ref) { final value = ref.watch(helloWorldProvider); return Text(value); // Hello world } } ``` **Note** You can watch as many providers inside [build] as you want to: ```dart @override Widget build(BuildContext context, WidgetRef ref) { final value = ref.watch(someProvider); final another = ref.watch(anotherProvider); return Text(value); // Hello world } ``` See also: - [ConsumerStatefulWidget], for a [StatefulWidget] variant. - [Consumer], to help reducing the number of rebuilt widgets without making a new widget.!riverpod.consumer_stateful_widget‚¯A [StatefulWidget] that has a [State] capable of reading providers. This is used exactly like a [StatefulWidget], but with a [State] that must subclass [ConsumerState] : ```dart class MyConsumer extends ConsumerStatefulWidget { const MyConsumer({Key? key}): super(key: key); @override ConsumerState createState() => _MyConsumerState(); } class _MyConsumerState extends ConsumerState { @override void initState() { // All State life-cycles can be used super.initState(); } @override Widget build(BuildContext context) { // "ref" is a property of ConsumerState and can be used to read providers ref.watch(someProvider); } } ```P|