ApiResponse<T>.fromMapJson constructor
ApiResponse<T>.fromMapJson (
- Map<
String, dynamic> json, { - ApiResponseDataConvert<
T> ? convert,
Implementation
factory ApiResponse.fromMapJson(Map<String, dynamic> json,
{ApiResponseDataConvert<T>? convert}) {
var data = json['data'];
var code = json['code'];
if (data != null && convert != null) {
final result = ApiResponse(
code: code, data: convert(Map<String, dynamic>.from(data)));
return result;
}
return ApiResponse(
code: code,
data: data,
message: json['msg'],
);
}