getList<T> method
Implementation
Future<List<T>> getList<T>(
String endpoint, {
required T Function(Map<String, dynamic>) fromJson,
Map<String, dynamic>? queryParameters,
}) async {
try {
final response = await _dio.get(
endpoint,
queryParameters: queryParameters,
);
final List data = response.data as List;
return data
.map((e) => fromJson(e as Map<String, dynamic>))
.toList();
} on DioException catch (e) {
throw Exception(_handleError(e));
}
}