Skip to content

Commit 4d1ee84

Browse files
committed
Add Skip if already exists option for local storage add/update operation.
1 parent 2d121b1 commit 4d1ee84

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/src/api/models/action/set_storage_action.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class SetStorageAction extends ActionModel
7474
@override
7575
final NumberOperation numberOperation;
7676

77+
final bool skipIfAlreadyExists;
78+
7779
/// Creates a new [SetStorageAction].
7880
SetStorageAction({
7981
this.key = 'key',
@@ -86,6 +88,7 @@ class SetStorageAction extends ActionModel
8688
this.mapOperation = MapOperation.replace,
8789
this.mapKey = 'key',
8890
this.numberOperation = NumberOperation.set,
91+
this.skipIfAlreadyExists = false,
8992
}) : super(type: ActionType.setStorage);
9093

9194
/// Duplicates this [SetStorageAction] with given data overrides.
@@ -100,6 +103,7 @@ class SetStorageAction extends ActionModel
100103
MapOperation? mapOperation,
101104
String? mapKey,
102105
NumberOperation? numberOperation,
106+
bool? skipIfAlreadyExists,
103107
}) {
104108
// final String? sanitizedValue = value == null
105109
// ? null
@@ -116,6 +120,7 @@ class SetStorageAction extends ActionModel
116120
mapOperation: mapOperation ?? this.mapOperation,
117121
mapKey: mapKey ?? this.mapKey,
118122
numberOperation: numberOperation ?? this.numberOperation,
123+
skipIfAlreadyExists: skipIfAlreadyExists ?? this.skipIfAlreadyExists,
119124
);
120125
}
121126

@@ -131,6 +136,7 @@ class SetStorageAction extends ActionModel
131136
mapOperation,
132137
mapKey,
133138
numberOperation,
139+
skipIfAlreadyExists,
134140
];
135141

136142
/// Creates a new [SetStorageAction] instance from a JSON data.

lib/src/api/models/action/set_storage_action.g.dart

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)