77part of 'built_complex_object.dart' ;
88
99// **************************************************************************
10- // Generator: BuiltValueGenerator
10+ // BuiltValueGenerator
1111// **************************************************************************
1212
1313// ignore_for_file: always_put_control_body_on_new_line
@@ -31,27 +31,7 @@ class _$BuiltComplexObjectSerializer
3131 @override
3232 Iterable serialize (Serializers serializers, BuiltComplexObject object,
3333 {FullType specifiedType: FullType .unspecified}) {
34- final result = < Object > [
35- 'anObject' ,
36- serializers.serialize (object.anObject,
37- specifiedType: const FullType (BuiltSimpleObject )),
38- 'aListOfStrings' ,
39- serializers.serialize (object.aListOfStrings,
40- specifiedType:
41- const FullType (BuiltList , const [const FullType (String )])),
42- 'aListOfInts' ,
43- serializers.serialize (object.aListOfInts,
44- specifiedType:
45- const FullType (BuiltList , const [const FullType (int )])),
46- 'aListOfDoubles' ,
47- serializers.serialize (object.aListOfDoubles,
48- specifiedType:
49- const FullType (BuiltList , const [const FullType (double )])),
50- 'aListOfObjects' ,
51- serializers.serialize (object.aListOfObjects,
52- specifiedType: const FullType (
53- BuiltList , const [const FullType (BuiltSimpleObject )])),
54- ];
34+ final result = < Object > [];
5535 if (object.aString != null ) {
5636 result
5737 ..add ('aString' )
@@ -70,6 +50,40 @@ class _$BuiltComplexObjectSerializer
7050 ..add (serializers.serialize (object.aDouble,
7151 specifiedType: const FullType (double )));
7252 }
53+ if (object.anObject != null ) {
54+ result
55+ ..add ('anObject' )
56+ ..add (serializers.serialize (object.anObject,
57+ specifiedType: const FullType (BuiltSimpleObject )));
58+ }
59+ if (object.aListOfStrings != null ) {
60+ result
61+ ..add ('aListOfStrings' )
62+ ..add (serializers.serialize (object.aListOfStrings,
63+ specifiedType:
64+ const FullType (BuiltList , const [const FullType (String )])));
65+ }
66+ if (object.aListOfInts != null ) {
67+ result
68+ ..add ('aListOfInts' )
69+ ..add (serializers.serialize (object.aListOfInts,
70+ specifiedType:
71+ const FullType (BuiltList , const [const FullType (int )])));
72+ }
73+ if (object.aListOfDoubles != null ) {
74+ result
75+ ..add ('aListOfDoubles' )
76+ ..add (serializers.serialize (object.aListOfDoubles,
77+ specifiedType:
78+ const FullType (BuiltList , const [const FullType (double )])));
79+ }
80+ if (object.aListOfObjects != null ) {
81+ result
82+ ..add ('aListOfObjects' )
83+ ..add (serializers.serialize (object.aListOfObjects,
84+ specifiedType: const FullType (
85+ BuiltList , const [const FullType (BuiltSimpleObject )])));
86+ }
7387
7488 return result;
7589 }
@@ -163,21 +177,7 @@ class _$BuiltComplexObject extends BuiltComplexObject {
163177 this .aListOfInts,
164178 this .aListOfDoubles,
165179 this .aListOfObjects})
166- : super ._() {
167- if (anObject == null )
168- throw new BuiltValueNullFieldError ('BuiltComplexObject' , 'anObject' );
169- if (aListOfStrings == null )
170- throw new BuiltValueNullFieldError (
171- 'BuiltComplexObject' , 'aListOfStrings' );
172- if (aListOfInts == null )
173- throw new BuiltValueNullFieldError ('BuiltComplexObject' , 'aListOfInts' );
174- if (aListOfDoubles == null )
175- throw new BuiltValueNullFieldError (
176- 'BuiltComplexObject' , 'aListOfDoubles' );
177- if (aListOfObjects == null )
178- throw new BuiltValueNullFieldError (
179- 'BuiltComplexObject' , 'aListOfObjects' );
180- }
180+ : super ._();
181181
182182 @override
183183 BuiltComplexObject rebuild (void updates (BuiltComplexObjectBuilder b)) =>
@@ -315,24 +315,24 @@ class BuiltComplexObjectBuilder
315315 aString: aString,
316316 anInt: anInt,
317317 aDouble: aDouble,
318- anObject: anObject .build (),
319- aListOfStrings: aListOfStrings .build (),
320- aListOfInts: aListOfInts .build (),
321- aListOfDoubles: aListOfDoubles .build (),
322- aListOfObjects: aListOfObjects .build ());
318+ anObject: _anObject ? .build (),
319+ aListOfStrings: _aListOfStrings ? .build (),
320+ aListOfInts: _aListOfInts ? .build (),
321+ aListOfDoubles: _aListOfDoubles ? .build (),
322+ aListOfObjects: _aListOfObjects ? .build ());
323323 } catch (_) {
324324 String _$failedField;
325325 try {
326326 _$failedField = 'anObject' ;
327- anObject .build ();
327+ _anObject ? .build ();
328328 _$failedField = 'aListOfStrings' ;
329- aListOfStrings .build ();
329+ _aListOfStrings ? .build ();
330330 _$failedField = 'aListOfInts' ;
331- aListOfInts .build ();
331+ _aListOfInts ? .build ();
332332 _$failedField = 'aListOfDoubles' ;
333- aListOfDoubles .build ();
333+ _aListOfDoubles ? .build ();
334334 _$failedField = 'aListOfObjects' ;
335- aListOfObjects .build ();
335+ _aListOfObjects ? .build ();
336336 } catch (e) {
337337 throw new BuiltValueNestedFieldError (
338338 'BuiltComplexObject' , _$failedField, e.toString ());
0 commit comments