HeliumTransaction.fromJson constructor

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

Creates an instance from a map derived from the JSON serialization.

Returns the appropriate subclass based on the type field. If the transaction type is not recognized, returns an instance of HeliumTransactionUnknown.

Implementation

factory HeliumTransaction.fromJson(Map<String, dynamic> json) {
  final type = HeliumTransactionType.get(json['type']);
  final deserializer = _deserializerMap[type];

  if (deserializer == null) {
    return HeliumTransactionUnknown.fromJson(json);
  }

  return deserializer(json);
}