[SYNC]
This commit is contained in:
@@ -17,11 +17,16 @@ class SheetStore extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Updates [item] in the store.
|
/// Updates [item] in the store.
|
||||||
void update(String itemID, dynamic value) {
|
void update(String itemID, dynamic value, {bool addIfAbsent = false}) {
|
||||||
if (!_items.containsKey(itemID)) {
|
if (!_items.containsKey(itemID)) {
|
||||||
|
if (addIfAbsent) {
|
||||||
|
add(itemID, value);
|
||||||
|
} else {
|
||||||
throw Exception('No item with the ID $itemID exist in the SheetStore, Are you sure you added it?');
|
throw Exception('No item with the ID $itemID exist in the SheetStore, Are you sure you added it?');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
_items[itemID] = value;
|
_items[itemID] = value;
|
||||||
|
}
|
||||||
// This call tells the widgets that are listening to this store to rebuild.
|
// This call tells the widgets that are listening to this store to rebuild.
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user