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