Justification Previously I wrote about using freezed with the awesome bloc library. Now let's look at the same example implemented with state_notifier to get a good understanding of the differences. The Counter State Notifier import 'package:freezed...

Markdown supported · ⌘↵ to post
Žan Fras
Features like middlewares are still doable here though:
The setter of "state" is overridable.
How to add something like loading state?
I tried:
@freezed abstract class CounterState with _$CounterState { const factory CounterState.initial([@Default(0) int value]) = _Initial; const factory CounterState.loading() = _Loading; const factory CounterState.current(int value) = _Current; }Of course I get an error if I try to use it in notifier, because current looses it:
The getter 'value' isn't defined for the type 'CounterState'.How to go about it?
Thanks