mirror of
https://github.com/rrousselGit/riverpod.git
synced 2025-08-15 18:28:00 +08:00
22 lines
482 B
Dart
22 lines
482 B
Dart
// ignore_for_file: unused_local_variable
|
|
|
|
import 'package:riverpod/riverpod.dart';
|
|
|
|
final otherProvider = Provider<int>((ref) => 0);
|
|
|
|
/* SNIPPET START */
|
|
final provider = NotifierProvider<MyNotifier, int>(MyNotifier.new);
|
|
|
|
class MyNotifier extends Notifier<int> {
|
|
@override
|
|
int build() {
|
|
// {@template watch}
|
|
// "Ref" can be used here to read other providers
|
|
// {@endtemplate}
|
|
final otherValue = ref.watch(otherProvider);
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
/* SNIPPET END */
|