You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
602 B

import 'package:json_annotation/json_annotation.dart';
part 'base_model.g.dart';
@JsonSerializable(includeIfNull: false)
class BaseModel {
final int code;
final String msg;
final bool success;
final dynamic data;
factory BaseModel.fromJson(Map<String, dynamic> json) =>
_$BaseModelFromJson(json);
static BaseModel error(
String? message, bool success, dynamic data, int code) =>
BaseModel(code: code, msg: message ?? '未知错误', success: success);
3 years ago
BaseModel({
required this.code,
required this.msg,
required this.success,
this.data,
});
}