Add null check in ApiClient.getList to handle cases where response.data is null, returning empty list instead of throwing cast error

This commit is contained in:
Leon Bösche
2026-01-24 03:39:31 +01:00
parent f53424aaa4
commit c1c8f837a8

View File

@@ -125,7 +125,9 @@ class ApiClient {
}) async {
try {
final response = await _dio.get(path, queryParameters: queryParameters);
return (response.data as List).map(fromJson).toList();
final data = response.data;
if (data == null) return [];
return (data as List).map(fromJson).toList();
} on DioException catch (e) {
throw _handleError(e);
}