Skip to content

Commit 5003ea1

Browse files
committed
fix: use bool.tryParse instead of casting
1 parent 4643a0c commit 5003ea1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class DioProperties extends AdditionalProperties {
342342

343343
DioProperties.fromMap(Map<String, dynamic> map)
344344
: dateLibrary = EnumTransformer.dioDateLibrary(map['dateLibrary']),
345-
nullableFields = map['nullableFields'] as bool?,
345+
nullableFields = bool.tryParse(map['nullableFields']),
346346
serializationLibrary = EnumTransformer.dioSerializationLibrary(
347347
map['serializationLibrary']),
348348
super.fromMap(map);
@@ -416,9 +416,9 @@ class DioAltProperties extends AdditionalProperties {
416416
wrapper: wrapper);
417417

418418
DioAltProperties.fromMap(Map<String, dynamic> map)
419-
: nullSafe = map['nullSafe'] as bool?,
420-
nullSafeArrayDefault = map['nullSafeArrayDefault'] as bool?,
421-
listAnyOf = map['listAnyOf'] as bool?,
419+
: nullSafe = bool.tryParse(map['nullSafe']) ,
420+
nullSafeArrayDefault = bool.tryParse(map['nullSafeArrayDefault'] ),
421+
listAnyOf = bool.tryParse(map['listAnyOf']),
422422
pubspecDependencies = map['pubspecDependencies'],
423423
pubspecDevDependencies = map['pubspecDevDependencies'],
424424
super.fromMap(map);

0 commit comments

Comments
 (0)