getApiResult<V> function

Future<Result<V, Exception>> getApiResult<V>(
  1. Function function
)

Implementation

Future<Result<V, Exception>> getApiResult<V>(Function function) async {
  try {
    final result = await function.call();
    return Result.success(result);
  } on Exception catch (error) {
    return Result.failure(error);
  }
}