BlockChainData.fromJson constructor

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

Implementation

factory BlockChainData.fromJson(Map<String, dynamic> json) {
  String identifier = json['identifier'] as String;
  switch (identifier) {
    case BlockChains.near:
      return NearBlockChainData.fromJson(json);
    case BlockChains.bitcoin:
      return BitcoinBlockChainData.fromJson(json);
    // Add more cases for other supported blockchains
    default:
      throw Exception('Unsupported blockchain data type');
  }
}