mirror of
https://github.com/rrousselGit/riverpod.git
synced 2025-08-15 10:11:27 +08:00
29 lines
549 B
Dart
29 lines
549 B
Dart
// ignore_for_file: unused_local_variable
|
|
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
part 'codegen.g.dart';
|
|
|
|
@riverpod
|
|
int other(Ref ref) => 0;
|
|
|
|
/* SNIPPET START */
|
|
@riverpod
|
|
class MyNotifier extends _$MyNotifier {
|
|
@override
|
|
int build() {
|
|
// {@template read}
|
|
// Bad! Do not use "read" here as it is not reactive
|
|
// {@endtemplate}
|
|
ref.read(otherProvider);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void increment() {
|
|
// {@template read2}
|
|
ref.read(otherProvider); // Using "read" here is fine
|
|
// {@endtemplate}
|
|
}
|
|
}
|