dreampad/lib/app/models/base_response_model.dart
2023-11-28 10:45:09 +08:00

33 lines
721 B
Dart

class BaseResponse {
bool? success;
int? code;
List<BaseErrors>? errors;
dynamic data;
BaseResponse({this.success, this.code, this.errors, this.data});
BaseResponse.fromJson(Map<String, dynamic> json) {
success = json['success'];
code = json['code'];
if (json.containsKey('errors')) {
errors = List<BaseErrors>.from(
json["errors"].map((x) => BaseErrors.fromJson(x)),
);
}
if (json.containsKey('data')) {
data = json['data'];
}
}
}
class BaseErrors {
int? code;
String? description;
BaseErrors({this.code, this.description});
BaseErrors.fromJson(Map<String, dynamic> json) {
code = json['code'];
description = json['description'];
}
}