diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 589ef137f34..b26f23891c0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -64,6 +64,7 @@ public class DartClientCodegen extends AbstractDartCodegen { final String libFolder = sourceFolder + File.separator + "lib"; supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml")); + supportingFiles.add(new SupportingFile("analysis_options.mustache", "", "analysis_options.yaml")); supportingFiles.add(new SupportingFile("api_client.mustache", libFolder, "api_client.dart")); supportingFiles.add(new SupportingFile("api_exception.mustache", libFolder, "api_exception.dart")); supportingFiles.add(new SupportingFile("api_helper.mustache", libFolder, "api_helper.dart")); diff --git a/modules/openapi-generator/src/main/resources/dart2/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart2/analysis_options.mustache new file mode 100644 index 00000000000..83d5a10bd7b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/analysis_options.mustache @@ -0,0 +1,3 @@ +analyzer: + strong-mode: + implicit-casts: true diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index f3af060d514..d7f90713d5f 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -65,7 +65,7 @@ class ApiClient { Future invokeAPI( String path, String method, - Iterable queryParams, + List queryParams, Object body, Map headerParams, Map formParams, @@ -177,13 +177,13 @@ class ApiClient { List queryParams, Map headerParams, ) { - authNames.forEach((authName) { + for(final authName in authNames) { final auth = _authentications[authName]; if (auth == null) { throw ArgumentError('Authentication undefined: $authName'); } auth.applyToParams(queryParams, headerParams); - }); + } } {{#native_serialization}} diff --git a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache index 0e4520d3e98..1d599915a0a 100644 --- a/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache @@ -132,9 +132,19 @@ class {{{classname}}} { {{/items.complexType}} {{/items.isArray}} {{^items.isArray}} + {{#items.isMap}} {{{name}}}: json[r'{{{baseName}}}'] == null ? null - : {{{complexType}}}.mapFromJson(json[r'{{{baseName}}}']), + {{#items.complexType}} + : {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']), + {{/items.complexType}} + {{^items.complexType}} + : (json[r'{{{baseName}}}'] as Map).cast(), + {{/items.complexType}} + {{/items.isMap}} + {{^items.isMap}} + {{{name}}}: json[r'{{{baseName}}}'] + {{/items.isMap}} {{/items.isArray}} {{/isMap}} {{^isMap}} @@ -189,12 +199,12 @@ class {{{classname}}} { static List<{{{classname}}}> listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : <{{{classname}}}>[] - : json.map((v) => {{{classname}}}.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => {{{classname}}}.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = {{{classname}}}.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = {{{classname}}}.fromJson(value)); } return map; } @@ -202,9 +212,9 @@ class {{{classname}}} { // maps a json object with a list of {{{classname}}}-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = {{{classname}}}.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = {{{classname}}}.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES index 7cc5afea821..733ecbe3062 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/FILES @@ -1,6 +1,7 @@ .gitignore .travis.yml README.md +analysis_options.yaml doc/ApiResponse.md doc/Category.md doc/Order.md diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/analysis_options.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/analysis_options.yaml new file mode 100644 index 00000000000..83d5a10bd7b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/analysis_options.yaml @@ -0,0 +1,3 @@ +analyzer: + strong-mode: + implicit-casts: true diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart index 35b984b86a1..37b6acfd4c6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart @@ -58,7 +58,7 @@ class ApiClient { Future invokeAPI( String path, String method, - Iterable queryParams, + List queryParams, Object body, Map headerParams, Map formParams, @@ -168,13 +168,13 @@ class ApiClient { List queryParams, Map headerParams, ) { - authNames.forEach((authName) { + for(final authName in authNames) { final auth = _authentications[authName]; if (auth == null) { throw ArgumentError('Authentication undefined: $authName'); } auth.applyToParams(queryParams, headerParams); - }); + } } static dynamic _deserialize(dynamic value, String targetType, {bool growable}) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index bd80caff35c..6bb070b7eeb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart @@ -65,12 +65,12 @@ class ApiResponse { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ApiResponse.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ApiResponse.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ApiResponse.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ApiResponse.fromJson(value)); } return map; } @@ -78,9 +78,9 @@ class ApiResponse { // maps a json object with a list of ApiResponse-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ApiResponse.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ApiResponse.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart index c63ffb1734f..c1c25b5a078 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart @@ -56,12 +56,12 @@ class Category { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Category.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Category.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Category.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Category.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class Category { // maps a json object with a list of Category-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Category.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Category.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index a7b01582664..4cf8b636f47 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -95,12 +95,12 @@ class Order { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Order.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Order.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Order.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Order.fromJson(value)); } return map; } @@ -108,9 +108,9 @@ class Order { // maps a json object with a list of Order-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Order.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Order.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index ee8c7615986..267e1485b8b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -91,12 +91,12 @@ class Pet { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Pet.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Pet.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Pet.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Pet.fromJson(value)); } return map; } @@ -104,9 +104,9 @@ class Pet { // maps a json object with a list of Pet-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Pet.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Pet.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart index 63132f08a3a..0cd372910b9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart @@ -56,12 +56,12 @@ class Tag { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Tag.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Tag.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Tag.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Tag.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class Tag { // maps a json object with a list of Tag-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Tag.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Tag.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart index bb512af491f..0eb3716fceb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/user.dart @@ -111,12 +111,12 @@ class User { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => User.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => User.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = User.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = User.fromJson(value)); } return map; } @@ -124,9 +124,9 @@ class User { // maps a json object with a list of User-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = User.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = User.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES index 80d5a3a8fc8..a5fe5c494d6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES @@ -1,6 +1,7 @@ .gitignore .travis.yml README.md +analysis_options.yaml doc/AdditionalPropertiesClass.md doc/Animal.md doc/AnotherFakeApi.md diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/analysis_options.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/analysis_options.yaml new file mode 100644 index 00000000000..83d5a10bd7b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/analysis_options.yaml @@ -0,0 +1,3 @@ +analyzer: + strong-mode: + implicit-casts: true diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 0aa83cf0197..cac7efad3bb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -61,7 +61,7 @@ class ApiClient { Future invokeAPI( String path, String method, - Iterable queryParams, + List queryParams, Object body, Map headerParams, Map formParams, @@ -171,13 +171,13 @@ class ApiClient { List queryParams, Map headerParams, ) { - authNames.forEach((authName) { + for(final authName in authNames) { final auth = _authentications[authName]; if (auth == null) { throw ArgumentError('Authentication undefined: $authName'); } auth.applyToParams(queryParams, headerParams); - }); + } } static dynamic _deserialize(dynamic value, String targetType, {bool growable}) { diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart index 9e021e550b0..b62ac79d3e2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/additional_properties_class.dart @@ -54,18 +54,18 @@ class AdditionalPropertiesClass { (json[r'map_property'] as Map).cast(), mapOfMapProperty: json[r'map_of_map_property'] == null ? null - : Map.mapFromJson(json[r'map_of_map_property']), + : (json[r'map_of_map_property'] as Map).cast(), ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => AdditionalPropertiesClass.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => AdditionalPropertiesClass.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = AdditionalPropertiesClass.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = AdditionalPropertiesClass.fromJson(value)); } return map; } @@ -73,9 +73,9 @@ class AdditionalPropertiesClass { // maps a json object with a list of AdditionalPropertiesClass-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = AdditionalPropertiesClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = AdditionalPropertiesClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart index 9786d8358b2..ba9066e4ef7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/animal.dart @@ -54,12 +54,12 @@ class Animal { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Animal.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Animal.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Animal.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Animal.fromJson(value)); } return map; } @@ -67,9 +67,9 @@ class Animal { // maps a json object with a list of Animal-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Animal.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Animal.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart index bd80caff35c..6bb070b7eeb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/api_response.dart @@ -65,12 +65,12 @@ class ApiResponse { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ApiResponse.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ApiResponse.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ApiResponse.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ApiResponse.fromJson(value)); } return map; } @@ -78,9 +78,9 @@ class ApiResponse { // maps a json object with a list of ApiResponse-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ApiResponse.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ApiResponse.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart index 7dac34b25c1..90ec9124de9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -51,12 +51,12 @@ class ArrayOfArrayOfNumberOnly { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ArrayOfArrayOfNumberOnly.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ArrayOfArrayOfNumberOnly.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ArrayOfArrayOfNumberOnly.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ArrayOfArrayOfNumberOnly.fromJson(value)); } return map; } @@ -64,9 +64,9 @@ class ArrayOfArrayOfNumberOnly { // maps a json object with a list of ArrayOfArrayOfNumberOnly-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ArrayOfArrayOfNumberOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ArrayOfArrayOfNumberOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart index 7a1de48923a..19b93cc3d73 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_of_number_only.dart @@ -49,12 +49,12 @@ class ArrayOfNumberOnly { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ArrayOfNumberOnly.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ArrayOfNumberOnly.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ArrayOfNumberOnly.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ArrayOfNumberOnly.fromJson(value)); } return map; } @@ -62,9 +62,9 @@ class ArrayOfNumberOnly { // maps a json object with a list of ArrayOfNumberOnly-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ArrayOfNumberOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ArrayOfNumberOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart index 55b131a9e57..c911626fa13 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/array_test.dart @@ -75,12 +75,12 @@ class ArrayTest { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ArrayTest.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ArrayTest.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ArrayTest.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ArrayTest.fromJson(value)); } return map; } @@ -88,9 +88,9 @@ class ArrayTest { // maps a json object with a list of ArrayTest-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ArrayTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ArrayTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart index afab73b9769..7b60d37fd39 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/capitalization.dart @@ -93,12 +93,12 @@ class Capitalization { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Capitalization.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Capitalization.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Capitalization.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Capitalization.fromJson(value)); } return map; } @@ -106,9 +106,9 @@ class Capitalization { // maps a json object with a list of Capitalization-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Capitalization.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Capitalization.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart index 704152151d8..94d0b96a9c7 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat.dart @@ -63,12 +63,12 @@ class Cat { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Cat.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Cat.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Cat.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Cat.fromJson(value)); } return map; } @@ -76,9 +76,9 @@ class Cat { // maps a json object with a list of Cat-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Cat.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Cat.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart index 307e777da3d..e3fe4944874 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/cat_all_of.dart @@ -47,12 +47,12 @@ class CatAllOf { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => CatAllOf.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => CatAllOf.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = CatAllOf.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = CatAllOf.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class CatAllOf { // maps a json object with a list of CatAllOf-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = CatAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = CatAllOf.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart index 59249c157a0..eddc54e7315 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/category.dart @@ -54,12 +54,12 @@ class Category { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Category.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Category.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Category.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Category.fromJson(value)); } return map; } @@ -67,9 +67,9 @@ class Category { // maps a json object with a list of Category-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Category.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Category.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart index 9192701eafd..927f01e06b6 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/class_model.dart @@ -47,12 +47,12 @@ class ClassModel { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ClassModel.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ClassModel.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ClassModel.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ClassModel.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class ClassModel { // maps a json object with a list of ClassModel-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ClassModel.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ClassModel.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart index eb08c1e227c..3a1efcb1c4f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog.dart @@ -63,12 +63,12 @@ class Dog { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Dog.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Dog.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Dog.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Dog.fromJson(value)); } return map; } @@ -76,9 +76,9 @@ class Dog { // maps a json object with a list of Dog-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Dog.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Dog.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart index 0199b8707d1..a77ba88b0bf 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/dog_all_of.dart @@ -47,12 +47,12 @@ class DogAllOf { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => DogAllOf.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => DogAllOf.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = DogAllOf.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = DogAllOf.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class DogAllOf { // maps a json object with a list of DogAllOf-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = DogAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = DogAllOf.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart index f0e7b2417db..dc994bc308a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_arrays.dart @@ -56,12 +56,12 @@ class EnumArrays { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => EnumArrays.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => EnumArrays.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = EnumArrays.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = EnumArrays.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class EnumArrays { // maps a json object with a list of EnumArrays-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = EnumArrays.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = EnumArrays.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart index ae432599c99..51a444f1cea 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/enum_test.dart @@ -108,12 +108,12 @@ class EnumTest { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => EnumTest.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => EnumTest.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = EnumTest.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = EnumTest.fromJson(value)); } return map; } @@ -121,9 +121,9 @@ class EnumTest { // maps a json object with a list of EnumTest-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = EnumTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = EnumTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart index fb5f7593554..4f659cddafa 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/file_schema_test_class.dart @@ -56,12 +56,12 @@ class FileSchemaTestClass { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => FileSchemaTestClass.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => FileSchemaTestClass.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = FileSchemaTestClass.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = FileSchemaTestClass.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class FileSchemaTestClass { // maps a json object with a list of FileSchemaTestClass-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = FileSchemaTestClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = FileSchemaTestClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart index 19994af4cfe..4100fa1fa04 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/foo.dart @@ -47,12 +47,12 @@ class Foo { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Foo.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Foo.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Foo.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Foo.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class Foo { // maps a json object with a list of Foo-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Foo.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Foo.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart index f0f2236ba88..5f735c24f86 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/format_test.dart @@ -192,12 +192,12 @@ class FormatTest { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => FormatTest.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => FormatTest.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = FormatTest.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = FormatTest.fromJson(value)); } return map; } @@ -205,9 +205,9 @@ class FormatTest { // maps a json object with a list of FormatTest-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = FormatTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = FormatTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart index 2054a4594f3..dee44032840 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/has_only_read_only.dart @@ -56,12 +56,12 @@ class HasOnlyReadOnly { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => HasOnlyReadOnly.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => HasOnlyReadOnly.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = HasOnlyReadOnly.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = HasOnlyReadOnly.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class HasOnlyReadOnly { // maps a json object with a list of HasOnlyReadOnly-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = HasOnlyReadOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = HasOnlyReadOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart index 1ea8db9305c..06a044bb153 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/health_check_result.dart @@ -47,12 +47,12 @@ class HealthCheckResult { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => HealthCheckResult.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => HealthCheckResult.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = HealthCheckResult.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = HealthCheckResult.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class HealthCheckResult { // maps a json object with a list of HealthCheckResult-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = HealthCheckResult.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = HealthCheckResult.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart index c48b5c28e70..1cdee99a2de 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/inline_response_default.dart @@ -47,12 +47,12 @@ class InlineResponseDefault { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => InlineResponseDefault.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => InlineResponseDefault.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = InlineResponseDefault.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = InlineResponseDefault.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class InlineResponseDefault { // maps a json object with a list of InlineResponseDefault-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = InlineResponseDefault.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = InlineResponseDefault.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart index 9843c474910..23a54bd34ae 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/map_test.dart @@ -67,7 +67,7 @@ class MapTest { : MapTest( mapMapOfString: json[r'map_map_of_string'] == null ? null - : Map.mapFromJson(json[r'map_map_of_string']), + : (json[r'map_map_of_string'] as Map).cast(), mapOfEnumString: json[r'map_of_enum_string'] == null ? null : (json[r'map_of_enum_string'] as Map).cast(), @@ -82,12 +82,12 @@ class MapTest { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => MapTest.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => MapTest.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = MapTest.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = MapTest.fromJson(value)); } return map; } @@ -95,9 +95,9 @@ class MapTest { // maps a json object with a list of MapTest-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = MapTest.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = MapTest.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart index b9a202de856..053427aafd1 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -61,20 +61,18 @@ class MixedPropertiesAndAdditionalPropertiesClass { dateTime: json[r'dateTime'] == null ? null : DateTime.parse(json[r'dateTime']), - map: json[r'map'] == null - ? null - : Animal.mapFromJson(json[r'map']), + map: json[r'map'] ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => MixedPropertiesAndAdditionalPropertiesClass.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => MixedPropertiesAndAdditionalPropertiesClass.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = MixedPropertiesAndAdditionalPropertiesClass.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = MixedPropertiesAndAdditionalPropertiesClass.fromJson(value)); } return map; } @@ -82,9 +80,9 @@ class MixedPropertiesAndAdditionalPropertiesClass { // maps a json object with a list of MixedPropertiesAndAdditionalPropertiesClass-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart index 15ecf90f50a..169581175eb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model200_response.dart @@ -56,12 +56,12 @@ class Model200Response { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Model200Response.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Model200Response.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Model200Response.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Model200Response.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class Model200Response { // maps a json object with a list of Model200Response-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Model200Response.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Model200Response.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart index 08b98859176..039517160be 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_client.dart @@ -47,12 +47,12 @@ class ModelClient { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ModelClient.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ModelClient.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ModelClient.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ModelClient.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class ModelClient { // maps a json object with a list of ModelClient-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ModelClient.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ModelClient.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart index 0ca3001c062..251cb11748b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_file.dart @@ -48,12 +48,12 @@ class ModelFile { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ModelFile.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ModelFile.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ModelFile.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ModelFile.fromJson(value)); } return map; } @@ -61,9 +61,9 @@ class ModelFile { // maps a json object with a list of ModelFile-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ModelFile.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ModelFile.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart index 973198375ad..c269cec60cf 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_list.dart @@ -47,12 +47,12 @@ class ModelList { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ModelList.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ModelList.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ModelList.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ModelList.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class ModelList { // maps a json object with a list of ModelList-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ModelList.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ModelList.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart index 50c58ca70f1..b4a37d9f633 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/model_return.dart @@ -47,12 +47,12 @@ class ModelReturn { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ModelReturn.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ModelReturn.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ModelReturn.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ModelReturn.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class ModelReturn { // maps a json object with a list of ModelReturn-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ModelReturn.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ModelReturn.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart index 264c1a8c04d..9068f61d639 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/name.dart @@ -72,12 +72,12 @@ class Name { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Name.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Name.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Name.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Name.fromJson(value)); } return map; } @@ -85,9 +85,9 @@ class Name { // maps a json object with a list of Name-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Name.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Name.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart index 0295e97b0d2..f1df88a935a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/nullable_class.dart @@ -144,26 +144,20 @@ class NullableClass { arrayNullableProp: Object.listFromJson(json[r'array_nullable_prop']), arrayAndItemsNullableProp: Object.listFromJson(json[r'array_and_items_nullable_prop']), arrayItemsNullable: Object.listFromJson(json[r'array_items_nullable']), - objectNullableProp: json[r'object_nullable_prop'] == null - ? null - : Object.mapFromJson(json[r'object_nullable_prop']), - objectAndItemsNullableProp: json[r'object_and_items_nullable_prop'] == null - ? null - : Object.mapFromJson(json[r'object_and_items_nullable_prop']), - objectItemsNullable: json[r'object_items_nullable'] == null - ? null - : Object.mapFromJson(json[r'object_items_nullable']), + objectNullableProp: json[r'object_nullable_prop'] + objectAndItemsNullableProp: json[r'object_and_items_nullable_prop'] + objectItemsNullable: json[r'object_items_nullable'] ); static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => NullableClass.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => NullableClass.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = NullableClass.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = NullableClass.fromJson(value)); } return map; } @@ -171,9 +165,9 @@ class NullableClass { // maps a json object with a list of NullableClass-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = NullableClass.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = NullableClass.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart index d710d3b50b2..16cc2514577 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/number_only.dart @@ -49,12 +49,12 @@ class NumberOnly { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => NumberOnly.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => NumberOnly.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = NumberOnly.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = NumberOnly.fromJson(value)); } return map; } @@ -62,9 +62,9 @@ class NumberOnly { // maps a json object with a list of NumberOnly-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = NumberOnly.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = NumberOnly.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart index a7b01582664..4cf8b636f47 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/order.dart @@ -95,12 +95,12 @@ class Order { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Order.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Order.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Order.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Order.fromJson(value)); } return map; } @@ -108,9 +108,9 @@ class Order { // maps a json object with a list of Order-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Order.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Order.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart index d2942660d23..c7aeb68f1ae 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_composite.dart @@ -67,12 +67,12 @@ class OuterComposite { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => OuterComposite.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => OuterComposite.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = OuterComposite.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = OuterComposite.fromJson(value)); } return map; } @@ -80,9 +80,9 @@ class OuterComposite { // maps a json object with a list of OuterComposite-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = OuterComposite.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = OuterComposite.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart index 4d58d276284..accf401ed9a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart @@ -45,12 +45,12 @@ class OuterObjectWithEnumProperty { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => OuterObjectWithEnumProperty.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => OuterObjectWithEnumProperty.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = OuterObjectWithEnumProperty.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = OuterObjectWithEnumProperty.fromJson(value)); } return map; } @@ -58,9 +58,9 @@ class OuterObjectWithEnumProperty { // maps a json object with a list of OuterObjectWithEnumProperty-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = OuterObjectWithEnumProperty.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = OuterObjectWithEnumProperty.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart index 47ef86dfcb2..3043edb921f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/pet.dart @@ -91,12 +91,12 @@ class Pet { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Pet.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Pet.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Pet.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Pet.fromJson(value)); } return map; } @@ -104,9 +104,9 @@ class Pet { // maps a json object with a list of Pet-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Pet.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Pet.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart index 3d8382c019e..b0eb02b6942 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/read_only_first.dart @@ -56,12 +56,12 @@ class ReadOnlyFirst { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => ReadOnlyFirst.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => ReadOnlyFirst.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = ReadOnlyFirst.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = ReadOnlyFirst.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class ReadOnlyFirst { // maps a json object with a list of ReadOnlyFirst-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = ReadOnlyFirst.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = ReadOnlyFirst.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart index 846ca82a7db..e43a6b267d2 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/special_model_name.dart @@ -47,12 +47,12 @@ class SpecialModelName { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => SpecialModelName.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => SpecialModelName.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = SpecialModelName.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = SpecialModelName.fromJson(value)); } return map; } @@ -60,9 +60,9 @@ class SpecialModelName { // maps a json object with a list of SpecialModelName-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = SpecialModelName.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = SpecialModelName.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart index 63132f08a3a..0cd372910b9 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/tag.dart @@ -56,12 +56,12 @@ class Tag { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => Tag.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => Tag.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = Tag.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = Tag.fromJson(value)); } return map; } @@ -69,9 +69,9 @@ class Tag { // maps a json object with a list of Tag-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = Tag.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = Tag.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart index bb512af491f..0eb3716fceb 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/user.dart @@ -111,12 +111,12 @@ class User { static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => json == null || json.isEmpty ? true == emptyIsNull ? null : [] - : json.map((v) => User.fromJson(v)).toList(growable: true == growable); + : json.map((dynamic value) => User.fromJson(value)).toList(growable: true == growable); static Map mapFromJson(Map json) { final map = {}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) => map[key] = User.fromJson(v)); + if (json?.isNotEmpty == true) { + json.forEach((key, value) => map[key] = User.fromJson(value)); } return map; } @@ -124,9 +124,9 @@ class User { // maps a json object with a list of User-objects as value to a dart map static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { final map = >{}; - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic v) { - map[key] = User.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + if (json?.isNotEmpty == true) { + json.forEach((key, value) { + map[key] = User.listFromJson(value, emptyIsNull: emptyIsNull, growable: growable,); }); } return map; diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES index a9cd914811b..56e6b6ec96e 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES @@ -1,6 +1,7 @@ .gitignore .travis.yml README.md +analysis_options.yaml build.yaml doc/AdditionalPropertiesClass.md doc/Animal.md diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/analysis_options.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/analysis_options.yaml new file mode 100644 index 00000000000..83d5a10bd7b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/analysis_options.yaml @@ -0,0 +1,3 @@ +analyzer: + strong-mode: + implicit-casts: true diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart index 65c9ec57844..02f98fe17a4 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart @@ -61,7 +61,7 @@ class ApiClient { Future invokeAPI( String path, String method, - Iterable queryParams, + List queryParams, Object body, Map headerParams, Map formParams, @@ -156,13 +156,13 @@ class ApiClient { List queryParams, Map headerParams, ) { - authNames.forEach((authName) { + for(final authName in authNames) { final auth = _authentications[authName]; if (auth == null) { throw ArgumentError('Authentication undefined: $authName'); } auth.applyToParams(queryParams, headerParams); - }); + } } }