| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import 'package:decimal/decimal.dart';
- /// 账户总览钱包项 - GET uc/asset/wallets
- /// walletType: SPOT=资金, SWAP=合约, FOLLOW=跟单, SPOT_TRADING=现货(虚拟,非服务端字段)
- class WalletOverview {
- final String walletType;
- final String name;
- final Decimal balance;
- const WalletOverview({
- required this.walletType,
- required this.name,
- required this.balance,
- });
- factory WalletOverview.fromJson(Map<String, dynamic> json) {
- return WalletOverview(
- walletType: json['walletType']?.toString() ?? '',
- name: json['name']?.toString() ?? '',
- balance:
- Decimal.tryParse(json['balance']?.toString() ?? '0') ?? Decimal.zero,
- );
- }
- /// 钱包类型显示名称
- String get displayName {
- switch (walletType) {
- case 'SPOT':
- return '资金账户';
- case 'SWAP':
- return '合约账户';
- case 'FOLLOW':
- return '跟单账户';
- case 'SPOT_TRADING':
- return '现货账户';
- default:
- return name;
- }
- }
- }
|