Files
2023-10-11 15:18:35 +02:00

24 lines
469 B
Dart

// ignore_for_file: unused_local_variable
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'codegen.g.dart';
final otherProvider = Provider<int>((ref) => 0);
/* SNIPPET START */
@riverpod
class MyNotifier extends _$MyNotifier {
@override
int build() {
// Bad! Do not use "ref" here as it is not reactive
ref.read(otherProvider);
return 0;
}
void increment() {
ref.read(otherProvider); // Using "read" here is fine
}
}