I am migrating my current Flutter app to riverpod 2.0. I have a provider that contains a class. I call the asynchronous methods in that class and render UI by watching that provider as you know.
When I use riverpod code generator with the @riverpod
annotation on the class, it overrides a build method. I returned null
to the build()
method and created my provider.
I am using the ref.watch(provider.notifier).asyncMethod
to call the methods without a problem but I could not figure out what the build method does. It says it initializes an AsyncNotifier
. When to use this build()
method.