1- // Example of a generated model:
2-
31//.title
42// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
53//
1715// ignore_for_file: unnecessary_null_comparison
1816// ignore_for_file: unnecessary_question_mark
1917
18+ // This line is not actually in the generated code.
2019import 'package:df_generate_dart_models_core/df_generate_dart_models_core.dart' ;
2120
21+ // This line is in the generated code.
22+ //part of 'field_model.dart';
23+
2224// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2325
2426/// Generated class for [_FieldModel] .
25- class FieldModel extends Model /* _FieldModel */ {
27+ class FieldModel extends Model {
2628 //
2729 //
2830 //
@@ -42,16 +44,16 @@ class FieldModel extends Model /* _FieldModel */ {
4244 /// Whether the field can hold a null value.
4345 final bool ? nullable;
4446
45- /// [Unimplemented] Children of this field, allowing for nested fields or complex structures.
46- final List <FieldModel >? children;
47+ /// Children of this field, allowing for nested fields or complex structures.
48+ final List <Map < String , dynamic > >? children;
4749
48- /// [Unimplemented] Whether this field serves as a primary key.
50+ /// Whether this field serves as a primary key.
4951 final bool ? primaryKey;
5052
51- /// [Unimplemented] Whether this field serves as a foreign key.
53+ /// Whether this field serves as a foreign key.
5254 final bool ? foreignKey;
5355
54- /// [Unimplemented] The default/fallback value for the field, to use in cases where the value is null
56+ /// The default/fallback value for the field, to use in cases where the value is null.
5557 final Object ? fallback;
5658
5759 /// A brief comment or explanation for the field's purpose.
@@ -89,7 +91,7 @@ class FieldModel extends Model /* _FieldModel */ {
8991 List <String >? fieldPath,
9092 dynamic ? fieldType,
9193 bool ? nullable,
92- List <FieldModel >? children,
94+ List <Map < String , dynamic > >? children,
9395 bool ? primaryKey,
9496 bool ? foreignKey,
9597 Object ? fallback,
@@ -214,19 +216,27 @@ class FieldModel extends Model /* _FieldModel */ {
214216 )
215217 .nonNulls
216218 .nullIfEmpty
217- ? .toList ();
219+ ? .toList ()
220+ .unmodifiable;
218221 final fieldType = json? ['fieldType' ];
219222 final nullable = letAsOrNull <bool >(json? ['nullable' ]);
220223 final children = letListOrNull <dynamic >(json? ['children' ])
221224 ? .map (
222- (p0) => () {
223- final a = letMapOrNull <String , dynamic >(p0);
224- return a != null ? FieldModel .fromJson (a) : null ;
225- }(),
225+ (p0) => letMapOrNull <dynamic , dynamic >(p0)
226+ ? .map (
227+ (p0, p1) => MapEntry (
228+ p0? .toString ().trim ().nullIfEmpty,
229+ p1,
230+ ),
231+ )
232+ .nonNulls
233+ .nullIfEmpty
234+ ? .unmodifiable,
226235 )
227236 .nonNulls
228237 .nullIfEmpty
229- ? .toList ();
238+ ? .toList ()
239+ .unmodifiable;
230240 final primaryKey = letAsOrNull <bool >(json? ['primaryKey' ]);
231241 final foreignKey = letAsOrNull <bool >(json? ['foreignKey' ]);
232242 final fallback = json? ['fallback' ];
@@ -293,7 +303,15 @@ class FieldModel extends Model /* _FieldModel */ {
293303 final nullable0 = nullable;
294304 final children0 = children
295305 ? .map (
296- (p0) => p0? .toJson (),
306+ (p0) => p0
307+ ? .map (
308+ (p0, p1) => MapEntry (
309+ p0? .trim ().nullIfEmpty,
310+ p1,
311+ ),
312+ )
313+ .nonNulls
314+ .nullIfEmpty,
297315 )
298316 .nonNulls
299317 .nullIfEmpty
@@ -320,41 +338,43 @@ class FieldModel extends Model /* _FieldModel */ {
320338 }
321339
322340 @override
323- BaseModel mergeWith (
341+ T mergeWith < T extends BaseModel > (
324342 BaseModel ? other, {
325343 bool deepMerge = false ,
326344 }) {
327345 final a = toJson ();
328346 final b = other? .toJson () ?? {};
329347 final data = (deepMerge ? mergeDataDeep (a, b) : {...a, ...b}) as Map ;
330- return FieldModel .fromJson (data.cast ());
348+ return FieldModel .fromJson (data.cast ()) as T ;
331349 }
332350
333351 /// Creates a copy of this instance, replacing the specified fields.
334- FieldModel copyWithFieldModelProperties ({
352+ static FieldModel copyWith (
353+ FieldModel src, {
335354 List <String >? fieldPath,
336355 dynamic ? fieldType,
337356 bool ? nullable,
338- List <FieldModel >? children,
357+ List <Map < String , dynamic > >? children,
339358 bool ? primaryKey,
340359 bool ? foreignKey,
341360 Object ? fallback,
342361 String ? description,
343362 }) {
344363 return FieldModel .assertRequired (
345- fieldPath: fieldPath ?? this .fieldPath,
346- fieldType: fieldType ?? this .fieldType,
347- nullable: nullable ?? this .nullable,
348- children: children ?? this .children,
349- primaryKey: primaryKey ?? this .primaryKey,
350- foreignKey: foreignKey ?? this .foreignKey,
351- fallback: fallback ?? this .fallback,
352- description: description ?? this .description,
364+ fieldPath: fieldPath ?? src .fieldPath,
365+ fieldType: fieldType ?? src .fieldType,
366+ nullable: nullable ?? src .nullable,
367+ children: children ?? src .children,
368+ primaryKey: primaryKey ?? src .primaryKey,
369+ foreignKey: foreignKey ?? src .foreignKey,
370+ fallback: fallback ?? src .fallback,
371+ description: description ?? src .description,
353372 );
354373 }
355374
356375 /// Creates a copy of this instance, removing the specified fields.
357- FieldModel copyWithoutFieldModelProperties ({
376+ static FieldModel copyWithout (
377+ FieldModel src, {
358378 bool fieldPath = true ,
359379 bool fieldType = true ,
360380 bool nullable = true ,
@@ -365,14 +385,14 @@ class FieldModel extends Model /* _FieldModel */ {
365385 bool description = true ,
366386 }) {
367387 return FieldModel .assertRequired (
368- fieldPath: fieldPath ? this .fieldPath : null ,
369- fieldType: fieldType ? this .fieldType : null ,
370- nullable: nullable ? this .nullable : null ,
371- children: children ? this .children : null ,
372- primaryKey: primaryKey ? this .primaryKey : null ,
373- foreignKey: foreignKey ? this .foreignKey : null ,
374- fallback: fallback ? this .fallback : null ,
375- description: description ? this .description : null ,
388+ fieldPath: fieldPath ? src .fieldPath : null ,
389+ fieldType: fieldType ? src .fieldType : null ,
390+ nullable: nullable ? src .nullable : null ,
391+ children: children ? src .children : null ,
392+ primaryKey: primaryKey ? src .primaryKey : null ,
393+ foreignKey: foreignKey ? src .foreignKey : null ,
394+ fallback: fallback ? src .fallback : null ,
395+ description: description ? src .description : null ,
376396 );
377397 }
378398
@@ -398,7 +418,7 @@ class FieldModel extends Model /* _FieldModel */ {
398418 /// If the field is nullable, the return value may be null; otherwise, it
399419 /// will always return a non-null value.
400420 @pragma ('vm:prefer-inline' )
401- List <FieldModel >? get children$ => children;
421+ List <Map < String , dynamic > >? get children$ => children;
402422
403423 /// Returns the value of the [primaryKey] field.
404424 /// If the field is nullable, the return value may be null; otherwise, it
0 commit comments