33 lines
721 B
Dart
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'];
|
||
|
}
|
||
|
}
|