Replies: 2 comments 1 reply
-
First thing first, StateNotifier is discouraged to use. Use Notifier instead. Notifier has build method overriden which allows you to start the timer when the Notifier is initialized. To implement the "complicated case," you can watch other two Notifiers from a Notifier in its build method. |
Beta Was this translation helpful? Give feedback.
-
Ok thanks, indeed the new notifier does everything better. In my last case, the notification should be triggered at the end of the build of the 3rd notifier - which compiles info from the other two? Or in a ref.listen, or an observe? Which brings us back to my first question :) |
Beta Was this translation helpful? Give feedback.
-
Hi.
I have a StateNotifier<Duration?>. When the state changes I want to trigger a notification, locally to show the user the time remaining.
I currently do the following:
Is this the right way to do it? Is there a better way? With an observer, a listen ref..... ?
And in a slightly more complicated case, if my notification depends on the state of two separate StateNotifiers, how can I best manage this? For example, I want the remaining time from this provider and a title from a second provider.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions