| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import 'package:freezed_annotation/freezed_annotation.dart';
- import 'package:flutter/foundation.dart';
- part 'user.freezed.dart';
- part 'user.g.dart';
- @freezed
- class User with _$User {
- const factory User({
- String? country,
- String? countryName,
- String? userIp,
- String? accessToken,
- String? refreshToken,
- String? accountKey,
- String? accountPassword,
- int? createTime, // API 返回 int 类型的时间戳
- bool? geographyEea,
- int? memberLevel, // 会员等级 1 游客 2 普通用户 3 会员
- int? userLevel,
- int? expireTime,
- int? remainTime,
- bool? isExpired,
- bool? isTestUser,
- bool? isSubscribeUser,
- Account? account, // API 返回对象类型
- bool? activated, // 是否激活
- }) = _User;
- factory User.fromJson(Map<String, Object?> json) => _$UserFromJson(json);
- }
- @freezed
- class Account with _$Account {
- const factory Account({
- String? username,
- String? phone,
- String? email,
- String? wechat,
- String? qq,
- String? google,
- String? apple,
- }) = _Account;
- factory Account.fromJson(Map<String, Object?> json) =>
- _$AccountFromJson(json);
- }
|