18 lines
456 B
Dart
18 lines
456 B
Dart
class ApiResponse<T> {
|
|
int? code;
|
|
T? data;
|
|
String? msg;
|
|
int? total;
|
|
|
|
ApiResponse({required this.code, this.data, this.msg, this.total});
|
|
factory ApiResponse.fromJson(
|
|
Map<String, dynamic> json, T Function(Object?) fromJsonT) {
|
|
return ApiResponse<T>(
|
|
code: json['code'] as int,
|
|
data: json['data'] != null ? fromJsonT(json['data']) : null,
|
|
msg: json['msg'] as String?,
|
|
total: json['total'] as int?,
|
|
);
|
|
}
|
|
}
|