@@ -253,7 +253,6 @@ class DartObject extends DartProperty {
253
253
(ConfigSetting ().nullsafety && item.nullable),
254
254
);
255
255
final bool isGetSet = fss.startsWith ('{' );
256
-
257
256
if (item is DartObject ) {
258
257
className = item.className;
259
258
@@ -319,11 +318,32 @@ class DartObject extends DartProperty {
319
318
< String > [typeString, name, lowName]));
320
319
fromJsonSb.writeLine (setString);
321
320
322
- final bool nonNullAble = ConfigSetting ().nullsafety && ! item.nullable;
321
+ // String setNameTemp = setName;
322
+
323
+ // if (className != null) {
324
+ // String toJson = '=> e.toJson()';
325
+ // dynamic value = item.value;
326
+ // String typeString = className;
327
+ // while (value is List) {
328
+ // toJson = '=> e.map(($typeString e) $toJson)';
329
+ // typeString = 'List<$typeString>';
330
+ // if (value.isNotEmpty) {
331
+ // value = value.first;
332
+ // } else {
333
+ // break;
334
+ // }
335
+ // }
336
+ // toJson = toJson.replaceFirst('=>', '');
337
+ // toJson = toJson.replaceFirst('e', '');
338
+ // toJson = toJson.trim();
339
+
340
+ // final bool nonNullAble = ConfigSetting().nullsafety && !item.nullable;
341
+ // setNameTemp += '${nonNullAble ? '' : '?'}$toJson';
342
+ // }
343
+
323
344
toJsonSb.writeLine (stringFormat (DartHelper .toJsonSetString, < String > [
324
345
item.key,
325
- setName +
326
- (item is DartObject ? '${nonNullAble ? '' : '?' }.toJson()' : '' )
346
+ setName,
327
347
]));
328
348
}
329
349
@@ -362,7 +382,8 @@ class DartObject extends DartProperty {
362
382
sb.writeLine (propertySb.toString ());
363
383
sb.writeLine (DartHelper .classToString);
364
384
sb.writeLine (toJsonSb.toString ());
365
- sb.writeLine (stringFormat (DartHelper .classToClone, < String > [className]));
385
+ sb.writeLine (stringFormat (DartHelper .classToClone,
386
+ < String > [className, if (ConfigSetting ().nullsafety) '!' else '' ]));
366
387
}
367
388
368
389
sb.writeLine (DartHelper .classFooter);
@@ -408,8 +429,6 @@ class DartObject extends DartProperty {
408
429
@override
409
430
List <Object ?> get props => < Object ? > [
410
431
className,
411
- nullable,
412
- propertyAccessorType,
413
- type,
432
+ properties,
414
433
];
415
434
}
0 commit comments