import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:json_annotation/json_annotation.dart';

class BaseBean<T> {
  T? data; // data对象
  List<T>? datalist; // data 是list
  BasePage<T>? dataPage; // data是分页
  int? code;
  String? msg;

  BaseBean.fromJson(dynamic json) {
    code = json["code"];
    msg = json["msg"];
    if (json['data'] != null && json['data'] != 'null') {
      try {
        if (json['data'] is List) {
          if (json['data'].tostring().contains("{")) {
            // datalist = JsonConvert.fromJsonAsT(json['data']);
          }
        }
      } catch (e, s) {}
    }
  }
}

class BasePage<T> {
  List<T>? list;
  T? data;
  int? total;
  int? page;
  int? pageSize;
}
