The getter 'state' isn't defined for the class 'StateNotifierProvider' for newer Riverpod versions
First of all, thanks for the excellent tutorial! It works fine as is, but after updating to
flutter_riverpod: ^0.14.0+1 the following errors appear:
ERROR: lib/presentation/weather_search_page.dart:23:45: Error: The getter 'state' isn't defined for the class 'StateNotifierProvider<WeatherNotifier, dynamic>'
ERROR: lib/presentation/weather_search_page.dart:37:59: Error: The getter 'state' isn't defined for the class 'StateNotifierProvider<WeatherNotifier, dynamic>'
Because this is a tutorial follow by many, I believe it's important to check whether it is a minor syntax change or something more profound.
Indeed, syntax of StateNotifierProvider has changed in version 0.14 as could be seen in the official repo: https://github.com/rrousselGit/river_pod/blob/master/examples/todos/lib/main.dart.
final todos = ref.watch(todoListProvider);
context.read(todoListProvider.notifier).add(value);
But the documenatation of the Riverpod package is not yet updated.
Actually, here is a migration guide: https://riverpod.dev/docs/migration/0.13.0_to_0.14.0
Anyone interested in the working project with riverpod version 0.14.0+3 please see this commit on my fork of this repo https://github.com/daniil-shumko/flutter-statenotifier-riverpod-tutorial/commit/6a6f7000eb2c4cb778fc2e7b8337815f0716607c
@daniil-shumko maybe you could create a PR?
@aboutandre only if @ResoDev is happy with the changes. He will also probably will have to update his video/blog post for this so that the code matches.