11//.title
22// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
33//
4- // Dart/Flutter (DF) Packages by dev-cetera.com & contributors. The use of this
5- // source code is governed by an MIT-style license described in the LICENSE
6- // file located in this project's root directory.
4+ // Copyright © dev-cetera.com & contributors.
5+ //
6+ // The use of this source code is governed by an MIT-style license described in
7+ // the LICENSE file located in this project's root directory.
78//
89// See: https://opensource.org/license/mit
910//
@@ -32,9 +33,7 @@ extension type DartFromRecordOnDartObjectX(_DartObject dartObj) {
3233 /// Returns `fieldName` property from [dartObj] if it matches the structure of
3334 /// [TFieldRecord] or `null` .
3435 List <String >? fieldPathFromRecord () {
35- return _rawFieldPathFromRecord ()
36- ? .map ((e) => e.replaceAll ('?' , '' ))
37- .toList ();
36+ return _rawFieldPathFromRecord ()? .map ((e) => e.replaceAll ('?' , '' )).toList ();
3837 }
3938
4039 List <String >? _rawFieldPathFromRecord () {
@@ -50,30 +49,20 @@ extension type DartFromRecordOnDartObjectX(_DartObject dartObj) {
5049 String ? fieldTypeFromRecord () {
5150 final raw = _rawFieldTypeFromRecord ();
5251 if (raw != null ) {
53- return raw.endsWith ('?' ) || raw.endsWith ('*' )
54- ? raw.substring (0 , raw.length - 1 )
55- : raw;
52+ return raw.endsWith ('?' ) || raw.endsWith ('*' ) ? raw.substring (0 , raw.length - 1 ) : raw;
5653 }
5754 return null ;
5855 }
5956
6057 String ? _rawFieldTypeFromRecord () {
6158 final a = dartObj.getField ('\$ 2' )? .toStringValue () as String ? ;
6259 final b =
63- dartObj
64- .getField ('\$ 2' )
65- ? .toTypeValue ()
66- ? .getDisplayString (withNullability: true )
67- as String ? ;
68- final c =
69- dartObj.getField (FieldModelFieldNames .fieldType)? .toStringValue ()
70- as String ? ;
71- final d =
72- dartObj
73- .getField (FieldModelFieldNames .fieldType)
74- ? .toTypeValue ()
75- ? .getDisplayString (withNullability: true )
76- as String ? ;
60+ dartObj.getField ('\$ 2' )? .toTypeValue ()? .getDisplayString (withNullability: true ) as String ? ;
61+ final c = dartObj.getField (FieldModelFieldNames .fieldType)? .toStringValue () as String ? ;
62+ final d = dartObj
63+ .getField (FieldModelFieldNames .fieldType)
64+ ? .toTypeValue ()
65+ ? .getDisplayString (withNullability: true ) as String ? ;
7766 return a ?? b ?? c ?? d;
7867 }
7968
@@ -84,8 +73,7 @@ extension type DartFromRecordOnDartObjectX(_DartObject dartObj) {
8473 return false ;
8574 }
8675
87- final a =
88- dartObj.getField (FieldModelFieldNames .nullable)? .toBoolValue () as bool ? ;
76+ final a = dartObj.getField (FieldModelFieldNames .nullable)? .toBoolValue () as bool ? ;
8977 final b = dartObj.getField ('\$ 3' )? .toBoolValue () as bool ? ;
9078 final c = _rawFieldPathFromRecord ()? .any ((e) => e.contains ('?' ));
9179 final d = _rawFieldTypeFromRecord ()? .endsWith ('?' );
@@ -95,32 +83,25 @@ extension type DartFromRecordOnDartObjectX(_DartObject dartObj) {
9583 /// Returns the `children` property from [dartObj] if it matches the structure of
9684 /// [TFieldRecord] or `null` .
9785 List <Map <String , dynamic >>? childrenFromRecord () {
98- final a =
99- dartObj
100- .getField (FieldModelFieldNames .children)
101- ? .toListValue ()
102- ? .map (
103- (e) => e.toMapValue ()! .map (
104- (k, v) => MapEntry (k! .toStringValue ()! , dartObjToObject (v)),
105- ),
106- )
107- as Iterable ? ;
86+ final a = dartObj.getField (FieldModelFieldNames .children)? .toListValue ()? .map (
87+ (e) => e.toMapValue ()! .map (
88+ (k, v) => MapEntry (k! .toStringValue ()! , dartObjToObject (v)),
89+ ),
90+ ) as Iterable ? ;
10891 final b = a? .map ((e) => (e as Map ).cast <String , dynamic >()).toList ();
10992 return b;
11093 }
11194
11295 /// Returns the `primaryKey` property from [dartObj] if it matches the structure
11396 /// of [TFieldRecord] or `null` .
11497 bool ? primaryKeyFromRecord () {
115- return dartObj.getField (FieldModelFieldNames .primaryKey)? .toBoolValue ()
116- as bool ? ;
98+ return dartObj.getField (FieldModelFieldNames .primaryKey)? .toBoolValue () as bool ? ;
11799 }
118100
119101 /// Returns the `foreignKey` property from [dartObj] if it matches the
120102 /// structure of [TFieldRecord] or `null` .
121103 bool ? foreignKeyFromRecord () {
122- return dartObj.getField (FieldModelFieldNames .foreignKey)? .toBoolValue ()
123- as bool ? ;
104+ return dartObj.getField (FieldModelFieldNames .foreignKey)? .toBoolValue () as bool ? ;
124105 }
125106
126107 /// Retrieves the `fallback` property from this `DartObject` if it matches
@@ -133,7 +114,6 @@ extension type DartFromRecordOnDartObjectX(_DartObject dartObj) {
133114 /// Returns the `description` property from [dartObj] record if it matches the
134115 /// structure of [TFieldRecord] or `null` .
135116 String ? descriptionFromRecord () {
136- return dartObj.getField (FieldModelFieldNames .description)? .toStringValue ()
137- as String ? ;
117+ return dartObj.getField (FieldModelFieldNames .description)? .toStringValue () as String ? ;
138118 }
139119}
0 commit comments