Skip to content

Instantly share code, notes, and snippets.

@daiki1003
Created July 19, 2021 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daiki1003/4353e6bb3dbf1ffd03e4b0a50ae98b33 to your computer and use it in GitHub Desktop.
Save daiki1003/4353e6bb3dbf1ffd03e4b0a50ae98b33 to your computer and use it in GitHub Desktop.
Sample for Riverpod
final authStateProvider = StateProvider<bool>(
(ref) => false,
);
final notificationsStateProvider = StateProvider<List<Notification>?>(
(ref) {
final authorized = ref.watch(authStateProvider).state;
if (authorized) {
// return ?
}
return null;
}
);
final chatsStateProvider = StateProvider<List<Chat>?>(
(ref) {
final authorized = ref.watch(authStateProvider).state;
if (authorized) {
// return ?
}
return null;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment