asActionResult method
Materialize Future
into Future<ActionResult>
]
Materialised future always succeed Returns CompletedResult if future resovled succesfully Returns FailedResult if future throws
If input future contains ActionResult
or QueryResult,
the result is flattened automatically.
If input future contains AsyncActionResult or AsyncQueryResult, only SucceededResult, CompletedResult, FailedResult are flattened automatically. Other values would cause exception.
Implementation
Future<ActionResult> asActionResult() async {
final dynamic result;
try {
result = await this;
} catch (error, stackTrace) {
return ActionResult.failed(error, stackTrace);
}
if (result is StatedResult) {
return ActionResult.from(result);
}
return ActionResult.completed();
}