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.

27 lines
631 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(
3 years ago
{String? message, bool? success, dynamic data, int? code}) =>
BaseModel(
code: code ?? 0, msg: message ?? '未知错误', success: success ?? false);
3 years ago
BaseModel({
required this.code,
required this.msg,
required this.success,
this.data,
});
}