[riverpod_generator] how to override provider which generated from riverpod_generator #2501
-
how to override provider generated from riverpod_generator |
Beta Was this translation helpful? Give feedback.
Answered by
rrousselGit
Apr 27, 2023
Replies: 2 comments 8 replies
-
Like non-generated providers: // For classes:
@riverpod
class Example extends _$Example {
int build() => 0;
}
exampleProvider.overrideWith(() => Example());
// For functions:
@riverpod
int example(ExampleRef ref) => 0;
exampleProvider.overrideWith((ref) => 0); |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
rrousselGit
-
Is there an update on this? I'm also trying to override an auto generated family provider, see implementation:
But the original provider is still being called. Seems like riverpod doesn't find this override in the provider scope. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Like non-generated providers: