add method
Add a new item to the end of data list.
Set isQuiet = true to avoid rendering loading state, default false.
Implementation
Future<void> add(T newItem, {bool isQuiet = false}) async {
_error = null;
_isAdding = true;
if (_isMounted && !isQuiet) notifyListeners();
try {
final result = await onAdd(newItem);
_data.add(result);
_isAdding = false;
if (_isMounted && !isQuiet) notifyListeners();
} catch (e) {
_isAdding = false;
_setError(e);
}
}