refresh method
Re-execute the last operation.
Throws StateError if no operation has been executed yet.
// Initial load
await user.execute(() => api.getUser());
// Later, to refresh:
await user.refresh();
Implementation
Future<void> refresh() async {
if (_lastOperation == null) {
throw StateError(
'Cannot refresh: no operation has been executed yet. '
'Call execute() first.',
);
}
await execute(_lastOperation!);
}