updateOrNull method
Future<void>
updateOrNull(
- FutureOr<
T> update(- T? old
- dynamic onError(
- Object e,
- StackTrace s
if State init value is null, you can use updateOrNull
Implementation
Future<void> updateOrNull(
FutureOr<T> Function(T? old) update, {
Function(Object e, StackTrace s)? onError,
}) async {
try {
final data = await update(valueOrNull);
put(data);
} catch (e, s) {
onError?.call(e, s);
if (onError == null) putError(e, s);
}
}