Skip to content

Commit 748707d

Browse files
committed
+breaking: Add support for better polymorphism
1 parent 30f7573 commit 748707d

File tree

9 files changed

+26
-21
lines changed

9 files changed

+26
-21
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@
1717
**/.github/.git
1818
**/.metadata
1919
**/.flutter-plugins
20-
**/.flutter-plugins-dependencies
20+
**/.flutter-plugins-dependencies
21+
**/pubspec_overrides.yaml
22+
23+
# Don't support IntelliJ.
24+
**/*.iml
25+
**/*.idea/

example/example.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class FieldModel extends Model /* _FieldModel */ {
320320
}
321321

322322
@override
323-
FieldModel mergeWith(
323+
BaseModel mergeWith(
324324
BaseModel? other, {
325325
bool deepMerge = false,
326326
}) {
@@ -331,7 +331,7 @@ class FieldModel extends Model /* _FieldModel */ {
331331
}
332332

333333
/// Creates a copy of this instance, replacing the specified fields.
334-
FieldModel copyWith({
334+
FieldModel copyWithFieldModelProperties({
335335
List<String>? fieldPath,
336336
dynamic? fieldType,
337337
bool? nullable,
@@ -354,7 +354,7 @@ class FieldModel extends Model /* _FieldModel */ {
354354
}
355355

356356
/// Creates a copy of this instance, removing the specified fields.
357-
FieldModel copyWithout({
357+
FieldModel copyWithoutFieldModelProperties({
358358
bool fieldPath = true,
359359
bool fieldType = true,
360360
bool nullable = true,

lib/src/models/data_ref/_data_ref_model.g.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class DataRefModel extends _DataRefModel {
237237
}
238238

239239
@override
240-
DataRefModel mergeWith(
240+
BaseModel mergeWith(
241241
BaseModel? other, {
242242
bool deepMerge = false,
243243
}) {
@@ -248,7 +248,7 @@ class DataRefModel extends _DataRefModel {
248248
}
249249

250250
/// Creates a copy of this instance, replacing the specified fields.
251-
DataRefModel copyWith({
251+
DataRefModel copyWithDataRefModelProperties({
252252
String? id,
253253
List<String>? collection,
254254
}) {
@@ -259,7 +259,7 @@ class DataRefModel extends _DataRefModel {
259259
}
260260

261261
/// Creates a copy of this instance, removing the specified fields.
262-
DataRefModel copyWithout({
262+
DataRefModel copyWithoutDataRefModelProperties({
263263
bool id = true,
264264
bool collection = true,
265265
}) {

lib/src/models/field_model/_field_model.g.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ class FieldModel extends _FieldModel {
334334
}
335335

336336
@override
337-
FieldModel mergeWith(
337+
BaseModel mergeWith(
338338
BaseModel? other, {
339339
bool deepMerge = false,
340340
}) {
@@ -345,7 +345,7 @@ class FieldModel extends _FieldModel {
345345
}
346346

347347
/// Creates a copy of this instance, replacing the specified fields.
348-
FieldModel copyWith({
348+
FieldModel copyWithFieldModelProperties({
349349
List<String>? fieldPath,
350350
dynamic? fieldType,
351351
bool? nullable,
@@ -368,7 +368,7 @@ class FieldModel extends _FieldModel {
368368
}
369369

370370
/// Creates a copy of this instance, removing the specified fields.
371-
FieldModel copyWithout({
371+
FieldModel copyWithoutFieldModelProperties({
372372
bool fieldPath = true,
373373
bool fieldType = true,
374374
bool nullable = true,

lib/src/models/generate_dart_model/_generate_dart_model.g.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class GenerateDartModel extends _GenerateDartModel {
283283
}
284284

285285
@override
286-
GenerateDartModel mergeWith(
286+
BaseModel mergeWith(
287287
BaseModel? other, {
288288
bool deepMerge = false,
289289
}) {
@@ -294,7 +294,7 @@ class GenerateDartModel extends _GenerateDartModel {
294294
}
295295

296296
/// Creates a copy of this instance, replacing the specified fields.
297-
GenerateDartModel copyWith({
297+
GenerateDartModel copyWithGenerateDartModelProperties({
298298
String? className,
299299
Set<dynamic>? fields,
300300
bool? shouldInherit,
@@ -314,7 +314,7 @@ class GenerateDartModel extends _GenerateDartModel {
314314
}
315315

316316
/// Creates a copy of this instance, removing the specified fields.
317-
GenerateDartModel copyWithout({
317+
GenerateDartModel copyWithoutGenerateDartModelProperties({
318318
bool className = true,
319319
bool fields = true,
320320
bool shouldInherit = true,

lib/src/models/model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Model extends BaseModel {
9696
//
9797

9898
@override
99-
Model mergeWith(
99+
BaseModel mergeWith(
100100
BaseModel? other, {
101101
bool deepMerge = false,
102102
}) {

lib/src/models/referenced_model.dart/_referenced_model.g.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class ReferencedModel extends _ReferencedModel {
225225
}
226226

227227
@override
228-
ReferencedModel mergeWith(
228+
BaseModel mergeWith(
229229
BaseModel? other, {
230230
bool deepMerge = false,
231231
}) {
@@ -236,7 +236,7 @@ class ReferencedModel extends _ReferencedModel {
236236
}
237237

238238
/// Creates a copy of this instance, replacing the specified fields.
239-
ReferencedModel copyWith({
239+
ReferencedModel copyWithReferencedModelProperties({
240240
String? id,
241241
DataRefModel? ref,
242242
}) {
@@ -247,7 +247,7 @@ class ReferencedModel extends _ReferencedModel {
247247
}
248248

249249
/// Creates a copy of this instance, removing the specified fields.
250-
ReferencedModel copyWithout({
250+
ReferencedModel copyWithoutReferencedModelProperties({
251251
bool id = true,
252252
bool ref = true,
253253
}) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
name: df_generate_dart_models_core
1414
description: A package that provides core dependencies for models generated with df_generate_dart_models.
15-
version: 0.6.11
15+
version: 0.7.0
1616
repository: https://github.com/DevCetra/df_generate_dart_models_core
1717
funding:
1818
- https://www.buymeacoffee.com/robmllze

templates/v2.dart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class ___CLASS_NAME___ extends ___SUPER_CLASS_NAME___ {
215215
}
216216
217217
@override
218-
___CLASS_NAME___ mergeWith(
218+
BaseModel mergeWith(
219219
BaseModel? other, {
220220
bool deepMerge = false,
221221
}) {
@@ -227,7 +227,7 @@ class ___CLASS_NAME___ extends ___SUPER_CLASS_NAME___ {
227227
228228
229229
/// Creates a copy of this instance, replacing the specified fields.
230-
___CLASS_NAME___ copyWith({
230+
___CLASS_NAME___ copyWith___CLASS_NAME___Properties({
231231
___COPY_WITH_PARAMS___
232232
}) {
233233
return ___CLASS_NAME___.assertRequired(
@@ -236,7 +236,7 @@ class ___CLASS_NAME___ extends ___SUPER_CLASS_NAME___ {
236236
}
237237
238238
/// Creates a copy of this instance, removing the specified fields.
239-
___CLASS_NAME___ copyWithout({
239+
___CLASS_NAME___ copyWithout___CLASS_NAME___Properties({
240240
___COPY_WITHOUT_PARAMS___
241241
}) {
242242
return ___CLASS_NAME___.assertRequired(

0 commit comments

Comments
 (0)