Skip to content

Instantly share code, notes, and snippets.

@MwBakker
Created January 7, 2022 23:11
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 MwBakker/66cd7479e641b982282f444d0451ce5c to your computer and use it in GitHub Desktop.
Save MwBakker/66cd7479e641b982282f444d0451ce5c to your computer and use it in GitHub Desktop.
import 'package:flutter_riverpod/flutter_riverpod.dart';
final indexNotifier = StateNotifierProvider<IndexNotifier>((ref) {
return IndexNotifier();
});
class IndexNotifier extends StateNotifier<int> {
IndexNotifier() : super(0);
void changeIndex(int index) {
state = index;
}
}
// ====== ERROR ======
// The type 'StateNotifierProvider' is declared with 2 type parameters,
// but 1 type arguments were given. (Documentation)
// Try adjusting the number of type arguments to match the number of type parameters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment