json_serializable.dart
json_serializable.dart copied to clipboard
how to handle dynamic type map or array
I have a scenario where data could be a dynamic map with values or an empty array, is there any annotation method to check null or isEmpty.
class myModel{
final Attr? attrs;
}
right now json['attrs'].isEmpty
this works but i lose changes when i run build runner again.
attrs: json['attrs'] == null || json['attrs'].isEmpty
? null
What type is Attr
?