hanleData<T> method
dynamic
hanleData<T>(
- Response response
Implementation
hanleData<T>(Response response) {
if (response.data != null) {
dynamic entity;
if (response.data is List) {
entity = BaseListEntity<List>.fromJson(response.data);
} else {
entity = BaseEntity<T>.fromJson(response.data);
}
if (entity.code == 200) {
return entity.data;
} else {
return ErrorEntity(entity.code, entity.message);
}
} else {
return ErrorEntity(-1, "未知错误");
}
}