parseJsonList<T> method

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

Parses the response body as a JSON list and converts each item.

Implementation

List<T>? parseJsonList<T>(T Function(Map<String, dynamic> json) fromJson) {
  final list = jsonListBody;
  if (list == null) return null;
  try {
    return list.map((e) => fromJson(e as Map<String, dynamic>)).toList();
  } catch (_) {
    return null;
  }
}