fromJson static method

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

Implementation

static TonWalletState? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return TonWalletState(
    address: (json['address'] as String?) ?? '',
    publicKey: (json['public_key'] as String?) ?? '',
    gramAmount: (json['gram_amount'] is int
            ? json['gram_amount'] as int
            : int.tryParse(json['gram_amount']?.toString() ?? '')) ??
        0,
    isBeingCreated: (json['is_being_created'] as bool?) ?? false,
    isBackupEnabled: (json['is_backup_enabled'] as bool?) ?? false,
    canEnableBackup: (json['can_enable_backup'] as bool?) ?? false,
    canExportPhrase: (json['can_export_phrase'] as bool?) ?? false,
  );
}