Add listFromJson method to fix #4887 (#5355)

This commit is contained in:
https://gitlab.com/selankon
2020-05-02 08:27:27 -05:00
committed by GitHub
parent 7d5695e551
commit 6439990463

View File

@@ -16,6 +16,10 @@ class {{classname}} {
static {{classname}} fromJson({{dataType}} value) {
return new {{classname}}TypeTransformer().decode(value);
}
static List<{{classname}}> listFromJson(List<dynamic> json) {
return json == null ? new List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList();
}
}
class {{classname}}TypeTransformer {