Closed AbdulHaseeeb closed 1 year ago
Hello!
whats the use of NumberNotifierRef ?
This is covered by the "reading" doc: https://docs-v2.riverpod.dev/docs/concepts/reading
Did riverpod select StateNotifierProvider automatically for my Counter Notifier in numberNotifier function ? as it says in the documentation ? If yes, is there any way to verify this ?
No. Cf #1788 and #1663
You typically don't write "StateNotifiers" with the code-generator.
Instead do:
@riverpod
class CounterNotifier extends _$CounterNotifier {
@override
int build() => 0;
increment() {
state = state + 1;
}
}
@riverpod class CounterNotifier extends _$CounterNotifier { @override int build() => 0;
increment() { state = state + 1; } }
hi @rrousselGit , can you give more explanation about the build() part
Thanks for the amazing package. Code generation will make riverpod much more easier. As a beginner its hard for me to sort out how to work with riverpod code generation, without some examples and documentation, for instance, I have a simple counterNotifier
whats the use of NumberNotifierRef ? Did riverpod select StateNotifierProvider automatically for my Counter Notifier in numberNotifier function ? as it says in the documentation ? If yes, is there any way to verify this ?
In my ui I cannot access increment method with numberNotifierProvider.
If it selected StateNotifierProvider automatically it should work just like that.