How can I fix the null value error. i'm using the bloc pattern. Please check the below image. Thanks in Advance.
Asked
Active
Viewed 1,024 times
-1
-
2Maybe you should define your class as `class BlocTime extends Bloc
{}` so that it accepts a `null` state? – Thierry Feb 28 '22 at 09:44 -
1Great. I created the answer so that you can close this issue. Happy coding! – Thierry Feb 28 '22 at 10:00
1 Answers
2
Defining the state of your Bloc as nullable should fix your issue:
StateTime?
instead of StateTime
class BlocTime extends Bloc<EventTime, StateTime?> {}

Thierry
- 7,775
- 2
- 15
- 33