createAsync<T> static method
Future<Response<T> >
createAsync<T>({
- required Future<
T> builder(), - required bool isError(
- T
- ErrorDetails? error,
Implementation
static Future<Response<T>> createAsync<T>({
required Future<T> Function() builder,
required bool Function(T) isError,
ErrorDetails? error,
}) async {
var payload = await builder();
if (isError(payload)) {
return Responses.failure([error ?? ErrorDetails(id: 0)]);
}
return Responses.success<T>(payload);
}