mapAsync<T, S> static method

Future<S> mapAsync<T, S>({
  1. required T data,
  2. required Mapper<T, S> mapper,
  3. bool printError = kDebugMode,
})

Maps the value of the future to a new value.

Implementation

static Future<S> mapAsync<T, S>(
    {required T data,
    required Mapper<T, S> mapper,
    bool printError = kDebugMode}) async {
  try {
    return await mapper(data);
  } catch (e, s) {
    if (printError) {
      PlayxCore.logger.error('MapAsync Error', error: e, stackTrace: s);
    }
    // Handle any errors in the main thread
    rethrow;
  }
}