My JSON is updating over time, at start, I may have Null value, but like 15 minutes later, I may have something. How can I do my Class with null safety ? I have this error when I create the class.
Asked
Active
Viewed 96 times
1 Answers
2
In the PowerPlayInfo.fromJson function the parameter is of type Map<String, dynamic>. Change the type to Map<String, dynamic>? (with the question mark) and it will be able to accept null values as well. You can read more about null safety here https://flutter.dev/docs/null-safety

Yair Chen
- 917
- 6
- 10