Question regarding a notifier its family "modifier" #2277
-
I have been looking through the docs and am fairly new to Dart / Riverpod but I can't seem to figure out how to pass an argument to a notifier created with a family. I have created the following provider: final entryFormStateProvider =
AutoDisposeFamilyNotifierProvider<EntryFormStateNotifier, EntryFormState, EntryFormState>(() {
return EntryFormStateNotifier();
}); But I can't figure out how to pass the family argument to the ref.watch(entryFormStateProvider(initialEntryFormState));
/// The expression doesn't evaluate to a function, so it can't be invoked. How exactly am I supposed to pass an argument to a NotifierProvider with a family notifier? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
You don't. The notifier naturally receive the parameter without having to do anything. Your Notifier base type should be |
Beta Was this translation helpful? Give feedback.
-
I am refactoring my StateNotifierProvider.autoDispose.family implementations to AutoDisposeNotifierProviderFamily. |
Beta Was this translation helpful? Give feedback.
You don't. The notifier naturally receive the parameter without having to do anything.
Your Notifier base type should be
AutoDisposeFamilyNotifier
(or whatever class with a similar name, I always forget).