update method
Updates _data
inside the repository.
If the creation is sucessful, will return true
. Otherwise, false
.
Note: userId is automatically applied to _data
.
Implementation
Future<bool> update() async {
if (_data is! T || !isInstanceValid(_data as T)) {
return false;
}
if (assignUserIdOnUpdate) {
_data = _data.copyWith(userId: userId);
}
await service.update(_data as T);
notifyListeners();
return true;
}