MagicData.fromJson constructor

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

Implementation

factory MagicData.fromJson(Map<String, dynamic> json) {
  return MagicData(
    email: json['email']?.toString(),
    address: json['address'].toString(),
    chainId: _parseChainId(json['chainId'].toString()),
    userName: json['userName']?.toString(),
    smartAccountDeployed: json['smartAccountDeployed'] as bool?,
    preferredAccountType: json['preferredAccountType']?.toString(),
    self: (json['self'] != null)
        ? ConnectionMetadata.fromJson(json['self'])
        : null,
    peer: (json['peer'] != null)
        ? ConnectionMetadata.fromJson(json['peer'])
        : null,
    provider: (json['provider'] != null)
        ? AppKitSocialOption.fromString(json['provider'].toString())
        : null,
  );
}