-1

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.

enter image description here

MendelG
  • 14,885
  • 4
  • 25
  • 52

1 Answers1

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