Replies: 2 comments 3 replies
-
No. @riverpod
class YourNotifier extends _$YourNotifier {
@override
YourState build() => YourState();
} |
Beta Was this translation helpful? Give feedback.
3 replies
-
There is a package to generated the equivalent of the https://pub.dev/packages/riverpod_state_provider_annotation # main.dart
import 'package:riverpod_state_provider_annotation/riverpod_state_provider_annotation.dart';
part 'main.g.dart';
part 'main.rsp.dart';
@RiverpodStateProvider()
int myState() {
return 0;
}
ref.watch(myStateProvider);
ref.read(myStateProvider.notifier).state++;
ref.read(myStateProvider.notifier).update((state) => state + 1);
ProviderScope(
overrides: [
myStateProvider.overrideWithValue(10),
],
) It still has some limitations but for simple usages (usually the case for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to use
riverpod_generator
to generate aStateNotifierProvider
for a function returning aStateNotifier<T>
?Beta Was this translation helpful? Give feedback.
All reactions