Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 6069627

Browse files
committed
Merge pull request #25 from davidmorgan/fix-null-serialization
Update test.
2 parents 0b160bd + 242d8aa commit 6069627

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

built_json_generator/test/built_json_generator_test.dart

+11
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,13 @@ abstract class Value implements Built<Value, ValueBuilder> {
189189
static final Serializer<Value> serializer = _$serializer;
190190
bool get aBool;
191191
@nullable double get aDouble;
192+
@nullable int get anInt;
192193
}
193194
194195
abstract class ValueBuilder implements Builder<Value, ValueBuilder> {
195196
bool aBool;
196197
@nullable double aDouble;
198+
@nullable int anInt;
197199
}
198200
'''),
199201
r'''// GENERATED CODE - DO NOT MODIFY BY HAND
@@ -223,6 +225,11 @@ class _$ValueSerializer implements StructuredSerializer<Value> {
223225
result.add(serializers.serialize(object.aDouble,
224226
specifiedType: const FullType(double)));
225227
}
228+
if (object.anInt != null) {
229+
result.add('anInt');
230+
result.add(serializers.serialize(object.anInt,
231+
specifiedType: const FullType(int)));
232+
}
226233
227234
return result;
228235
}
@@ -252,6 +259,10 @@ class _$ValueSerializer implements StructuredSerializer<Value> {
252259
result.aDouble = serializers.deserialize(value,
253260
specifiedType: const FullType(double));
254261
break;
262+
case 'anInt':
263+
result.anInt = serializers.deserialize(value,
264+
specifiedType: const FullType(int));
265+
break;
255266
}
256267
}
257268
}

0 commit comments

Comments
 (0)