From 6439990463f0410504111be01855c4baefeca64c Mon Sep 17 00:00:00 2001 From: "https://gitlab.com/selankon" Date: Sat, 2 May 2020 08:27:27 -0500 Subject: [PATCH] Add listFromJson method to fix #4887 (#5355) --- .../openapi-generator/src/main/resources/dart2/enum.mustache | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache index 87bbed91767..24ce94f0435 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -16,6 +16,10 @@ class {{classname}} { static {{classname}} fromJson({{dataType}} value) { return new {{classname}}TypeTransformer().decode(value); } + + static List<{{classname}}> listFromJson(List json) { + return json == null ? new List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList(); + } } class {{classname}}TypeTransformer {