update property
OnData<TParsed> ?
get
update
Implementation
OnData<TParsed>? get update {
if (options.update != null) {
// dereference all variables that might be needed if the widget is disposed
final OnMutationUpdate<TParsed>? widgetUpdate = options.update;
final OnData<TParsed> optimisticUpdate = _optimisticUpdate;
// wrap update logic to handle optimism
FutureOr<void> updateOnData(QueryResult<TParsed>? result) {
if (result!.isOptimistic) {
return optimisticUpdate(result);
} else {
return widgetUpdate!(cache, result);
}
}
return updateOnData;
}
return null;
}