runAction method
Run action against this record and, on success, re-fetch — an
action's most common effect is changing exactly the permissions and
actions this provider is holding, so the pre-run record is stale the
moment the call succeeds.
The result is returned rather than folded into status: the screen decides whether the message is a snack bar or a banner, and a failed action is not a failed screen — the record is still fine to display.
Implementation
Future<ActionResult> runAction(RecordAction action) async {
final result = await _source.runAction(resource.key, id, action.name);
if (result is ActionSuccess) {
await load();
}
return result;
}