Skip to content

Commit 4577567

Browse files
committed
used constants
1 parent 7654fb0 commit 4577567

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

json_serializable/lib/src/type_helpers/enum_helper.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class EnumHelper extends TypeHelper<TypeHelperContextWithConfig> {
6161
}
6262

6363
String functionName;
64-
if (targetType.isNullableType || defaultProvided) {
65-
functionName = r'$enumDecodeNullable';
66-
} else if (jsonKey.unknownEnumValue == r'JsonKey.skipForUndefinedEnumValue') {
64+
if (targetType.isNullableType ||
65+
defaultProvided ||
66+
jsonKey.unknownEnumValue == jsonKeySkipForUndefinedEnumValueFieldName) {
6767
functionName = r'$enumDecodeNullable';
6868
} else {
6969
functionName = r'$enumDecode';

json_serializable/lib/src/type_helpers/iterable_helper.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class IterableHelper extends TypeHelper<TypeHelperContextWithConfig> {
103103

104104
if (_coreListChecker.isExactlyType(targetType)) {
105105
final jsonKey = jsonKeyForField(context.fieldElement, context.config);
106-
final shouldRemoveNulls = jsonKey.unknownEnumValue == jsonKeyNullForUndefinedEnumValueFieldName;
106+
final shouldRemoveNulls = jsonKey.unknownEnumValue == jsonKeySkipForUndefinedEnumValueFieldName;
107107

108108
output += '$optionalQuestion${shouldRemoveNulls ? '.nonNulls' : ''}.toList()';
109109
} else if (_coreSetChecker.isExactlyType(targetType)) {

0 commit comments

Comments
 (0)