json_to_dart
json_to_dart copied to clipboard
[request] add option for null handling
hello.
thanks for your great json to dart converter. regarding request, can you create option for null handling? for example, when the input is:
{
"nopo": "PO00000390",
"address": "Jl. Jend Sudirman No. 1"
}
the output is:
class Autogenerated {
String nopo;
int quantity;
Autogenerated({this.nopo, this.quantity});
Autogenerated.fromJson(Map<String, dynamic> json) {
nopo = json['nopo'] ?? "";
quantity = json['quantity'] ?? 0;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['nopo'] = this.nopo;
data['quantity'] = this.quantity;
return data;
}
}
thank you
Hey this is a really good idea. I'll try to give this priority whenever I get my hands on this.