TronAccountModel.fromJson constructor

TronAccountModel.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory TronAccountModel.fromJson(Map<String, dynamic> json) {
  return TronAccountModel._(
    accountName: json['account_name'],
    address: json['address'],
    balance: BigintUtils.parse(json['balance'] ?? BigInt.zero),
    createTime: BigintUtils.parse(json['create_time']),
    latestOperationTime: BigintUtils.tryParse(json['latest_opration_time']),
    frozenSupply: (json['frozen_supply'] as List?)
            ?.map((supply) => FrozenSupplyModel.fromJson(supply))
            .toList() ??
        <FrozenSupplyModel>[],
    assetIssuedName: json['asset_issued_name'],
    freeNetUsage: json['free_net_usage'],
    latestConsumeFreeTime:
        BigintUtils.tryParse(json['latest_consume_free_time']),
    netWindowSize: json['net_window_size'],
    netWindowOptimized: json['net_window_optimized'],
    accountResource:
        TronAccountResourceModel.fromJson(json['account_resource']),
    ownerPermission:
        AccountPermissionModel.fromJson(json['owner_permission']),
    activePermissions: (json['active_permission'] as List<dynamic>)
        .map((permission) => AccountPermissionModel.fromJson(permission))
        .toList(),
    witnessPermission: json["witness_permission"] == null
        ? null
        : AccountPermissionModel.fromJson(json['witness_permission']),
    frozenV2: (json['frozenV2'] as List<dynamic>)
        .map((frozen) => FrozenV2Model.fromJson(frozen))
        .toList(),
    unfrozenV2: (json['unfrozenV2'] as List?)
            ?.map((unfrozen) => UnfrozenV2Model.fromJson(unfrozen))
            .toList() ??
        <UnfrozenV2Model>[],
    assetV2: (json['assetV2'] as List?)
            ?.map((asset) => AssetV2Model.fromJson(asset))
            .toList() ??
        <AssetV2Model>[],
    assetIssuedID: json['asset_issued_ID'],
    freeAssetNetUsageV2: (json['free_asset_net_usageV2'] as List?)
            ?.map((usage) => FreeAssetNetUsageV2Model.fromJson(usage))
            .toList() ??
        <FreeAssetNetUsageV2Model>[],
    assetOptimized: json['asset_optimized'],
  );
}