Replies: 1 comment
-
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
-
I have the following provider
final completeProfileImageProvider = StateProvider.autoDispose<File?>((ref) { return null; });
and update its value like
ref.read(completeProfileImageProvider.notifier).state = file;
now I get warning
To solve this I tried to use @riverpod generator but I couldn't update the value
I know I think I can use class based generator approach but I have more providers like this which I dont want to convert to clases what is the solution here?
Beta Was this translation helpful? Give feedback.
All reactions