parseJson<T> method

T? parseJson<T>(
  1. T fromJson(
    1. Map<String, dynamic> json
    )
)

Parses the response body as JSON and converts it using the provided function.

Implementation

T? parseJson<T>(T Function(Map<String, dynamic> json) fromJson) {
  final json = jsonBody;
  if (json == null) return null;
  try {
    return fromJson(json);
  } catch (_) {
    return null;
  }
}