request<T, E> method

Future<T> request<T, E>(
  1. BlockforestRequestParam<T, E> request, [
  2. Duration? timeout
])

Sends a request to the blockfrost network using the specified request parameter.

The timeout parameter, if provided, sets the maximum duration for the request.

Implementation

Future<T> request<T, E>(BlockforestRequestParam<T, E> request,
    [Duration? timeout]) async {
  final data = await requestDynamic(request, timeout);
  final Object result;
  if (E == List<Map<String, dynamic>>) {
    result = (data as List).map((e) => Map<String, dynamic>.from(e)).toList();
  } else {
    result = data;
  }
  return request.onResonse(result as E);
}