@@ -40,36 +40,22 @@ class DataRefModel extends _DataRefModel {
4040
4141 /// Constructs a new instance of [DataRefModel]
4242 /// from optional and required parameters.
43- const DataRefModel ({
44- this .id,
45- required this .collection,
46- });
43+ const DataRefModel ({this .id, required this .collection});
4744
4845 /// Construcs a new instance of [DataRefModel] ,
4946 /// forcing all parameters to be optional.
50- const DataRefModel .optional ({
51- this .id,
52- this .collection,
53- });
47+ const DataRefModel .optional ({this .id, this .collection});
5448
5549 /// Constructs a new instance of [DataRefModel] ,
5650 /// and asserts that all required parameters are not null.
57- factory DataRefModel .assertRequired ({
58- String ? id,
59- List <String >? collection,
60- }) {
51+ factory DataRefModel .assertRequired ({String ? id, List <String >? collection}) {
6152 assert (collection != null );
62- return DataRefModel (
63- id: id,
64- collection: collection,
65- );
53+ return DataRefModel (id: id, collection: collection);
6654 }
6755
6856 /// Constructs a new instance of [DataRefModel] ,
6957 /// from the fields of [another] instance. Throws if the conversion fails.
70- factory DataRefModel .from (
71- BaseModel another,
72- ) {
58+ factory DataRefModel .from (BaseModel another) {
7359 try {
7460 return fromOrNull (another)! ;
7561 } catch (e) {
@@ -82,17 +68,13 @@ class DataRefModel extends _DataRefModel {
8268 /// from the fields of [another] instance. Returns `null` if [another] is
8369 /// `null` or if the conversion fails.
8470 @pragma ('vm:prefer-inline' )
85- static DataRefModel ? fromOrNull (
86- BaseModel ? another,
87- ) {
71+ static DataRefModel ? fromOrNull (BaseModel ? another) {
8872 return fromJsonOrNull (another? .toJson ())! ;
8973 }
9074
9175 /// Constructs a new instance of [DataRefModel] ,
9276 /// from the fields of [another] instance. Throws if the conversion fails.
93- factory DataRefModel .of (
94- DataRefModel another,
95- ) {
77+ factory DataRefModel .of (DataRefModel another) {
9678 try {
9779 return ofOrNull (another)! ;
9880 } catch (e) {
@@ -105,18 +87,14 @@ class DataRefModel extends _DataRefModel {
10587 /// from the fields of [another] instance. Returns `null` if [another] is
10688 /// `null` or if the conversion fails.
10789 @pragma ('vm:prefer-inline' )
108- static DataRefModel ? ofOrNull (
109- DataRefModel ? other,
110- ) {
90+ static DataRefModel ? ofOrNull (DataRefModel ? other) {
11191 return fromJsonOrNull (other? .toJson ());
11292 }
11393
11494 /// Constructs a new instance of [DataRefModel] ,
11595 /// from [jsonString] , which must be a valid JSON String. Throws if the
11696 /// conversion fails.
117- factory DataRefModel .fromJsonString (
118- String jsonString,
119- ) {
97+ factory DataRefModel .fromJsonString (String jsonString) {
12098 try {
12199 return fromJsonStringOrNull (jsonString)! ;
122100 } catch (e) {
@@ -128,9 +106,7 @@ class DataRefModel extends _DataRefModel {
128106 /// Constructs a new instance of [DataRefModel] ,
129107 /// from [jsonString] , which must be a valid JSON String. Returns `null` if
130108 /// [jsonString] is `null` or if the conversion fails.
131- static DataRefModel ? fromJsonStringOrNull (
132- String ? jsonString,
133- ) {
109+ static DataRefModel ? fromJsonStringOrNull (String ? jsonString) {
134110 try {
135111 if (jsonString! .isNotEmpty) {
136112 final decoded = letMapOrNull <String , dynamic >(jsonDecode (jsonString));
@@ -146,9 +122,7 @@ class DataRefModel extends _DataRefModel {
146122 /// Constructs a new instance of [DataRefModel] ,
147123 /// from [json] , which must be a valid JSON object. Throws if the conversion
148124 /// fails.
149- factory DataRefModel .fromJson (
150- Map <String , dynamic >? json,
151- ) {
125+ factory DataRefModel .fromJson (Map <String , dynamic >? json) {
152126 try {
153127 return fromJsonOrNull (json)! ;
154128 } catch (e) {
@@ -160,23 +134,16 @@ class DataRefModel extends _DataRefModel {
160134 /// Constructs a new instance of [DataRefModel] ,
161135 /// from [json] , which must be a valid JSON object. Returns `null` if
162136 /// [json] is `null` or if the conversion fails.
163- static DataRefModel ? fromJsonOrNull (
164- Map <String , dynamic >? json,
165- ) {
137+ static DataRefModel ? fromJsonOrNull (Map <String , dynamic >? json) {
166138 try {
167139 final id = json? ['id' ]? .toString ().trim ().nullIfEmpty;
168140 final collection = letListOrNull <dynamic >(json? ['collection' ])
169- ? .map (
170- (p0) => p0? .toString ().trim ().nullIfEmpty,
171- )
141+ ? .map ((p0) => p0? .toString ().trim ().nullIfEmpty)
172142 .nonNulls
173143 .nullIfEmpty
174144 ? .toList ()
175145 .unmodifiable;
176- return DataRefModel (
177- id: id,
178- collection: collection,
179- );
146+ return DataRefModel (id: id, collection: collection);
180147 } catch (e) {
181148 return null ;
182149 }
@@ -185,9 +152,7 @@ class DataRefModel extends _DataRefModel {
185152 /// Constructs a new instance of [DataRefModel] ,
186153 /// from the query parameters of [uri] . Throws if the conversion
187154 /// fails.
188- factory DataRefModel .fromUri (
189- Uri ? uri,
190- ) {
155+ factory DataRefModel .fromUri (Uri ? uri) {
191156 try {
192157 return fromUriOrNull (uri)! ;
193158 } catch (e) {
@@ -199,9 +164,7 @@ class DataRefModel extends _DataRefModel {
199164 /// Constructs a new instance of [DataRefModel] ,
200165 /// from the query parameters of [uri] . Returns `null` if [uri] is `null` or
201166 /// if the conversion fails.
202- static DataRefModel ? fromUriOrNull (
203- Uri ? uri,
204- ) {
167+ static DataRefModel ? fromUriOrNull (Uri ? uri) {
205168 try {
206169 if (uri != null && uri.path == CLASS_NAME ) {
207170 return DataRefModel .fromJson (uri.queryParameters);
@@ -214,22 +177,15 @@ class DataRefModel extends _DataRefModel {
214177 }
215178
216179 @override
217- Map <String , dynamic > toJson ({
218- bool includeNulls = false ,
219- }) {
180+ Map <String , dynamic > toJson ({bool includeNulls = false }) {
220181 try {
221182 final id0 = id? .trim ().nullIfEmpty;
222183 final collection0 = collection
223- ? .map (
224- (p0) => p0? .trim ().nullIfEmpty,
225- )
184+ ? .map ((p0) => p0? .trim ().nullIfEmpty)
226185 .nonNulls
227186 .nullIfEmpty
228187 ? .toList ();
229- final withNulls = {
230- 'id' : id0,
231- 'collection' : collection0,
232- };
188+ final withNulls = {'id' : id0, 'collection' : collection0};
233189 return includeNulls ? withNulls : withNulls.nonNulls;
234190 } catch (e) {
235191 assert (false , '$DataRefModel .toJson: $e ' );
@@ -263,32 +219,23 @@ abstract final class DataRefModelFieldNames {
263219extension DataRefModelX on DataRefModel {
264220 /// Creates a copy of this instance, merging another model's fields into
265221 /// this model's fields.
266- DataRefModel mergeWith (
267- BaseModel ? other, {
268- bool deepMerge = false ,
269- }) {
222+ DataRefModel mergeWith (BaseModel ? other, {bool deepMerge = false }) {
270223 final a = toJson ();
271224 final b = other? .toJson () ?? {};
272225 final data = (deepMerge ? mergeDataDeep (a, b) : {...a, ...b}) as Map ;
273226 return DataRefModel .fromJson (data.cast ());
274227 }
275228
276229 /// Creates a copy of this instance, replacing the specified fields.
277- DataRefModel copyWith ({
278- String ? id,
279- List <String >? collection,
280- }) {
230+ DataRefModel copyWith ({String ? id, List <String >? collection}) {
281231 return DataRefModel .assertRequired (
282232 id: id ?? this .id,
283233 collection: collection ?? this .collection,
284234 );
285235 }
286236
287237 /// Creates a copy of this instance, removing the specified fields.
288- DataRefModel copyWithout ({
289- bool id = true ,
290- bool collection = true ,
291- }) {
238+ DataRefModel copyWithout ({bool id = true , bool collection = true }) {
292239 return DataRefModel .assertRequired (
293240 id: id ? this .id : null ,
294241 collection: collection ? this .collection : null ,
0 commit comments