
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'counter_screen_controller.g.dart';


/// Annotating a class by `@riverpod` defines a new shared 
/// state for your application,
/// accessible using the generated [counterProvider].
/// This class is both responsible for initializing the state (through the 
/// [build] method)
/// and exposing ways to modify it (cf [increment]).
@riverpod
class Counter extends _$Counter {
  /// Classes annotated by `@riverpod` **must** define a [build] function.
  /// This function is expected to return the initial state of your 
  /// shared state.
  /// It is totally acceptable for this function to return a [Future] or 
  /// [Stream] if you need to.
  /// You can also freely define parameters on this method.
  @override
  int build() => 0;

  void increment() => state++;
}
