fromJson static method

Output fromJson(
  1. Map<String, dynamic> jsonOutput
)

Implementation

static Output fromJson(Map<String, dynamic> jsonOutput) {
  int outputType = jsonOutput['type'];
  switch (outputType) {
    case 0:
      return OutputCoin.fromJson(jsonOutput);
    case 1:
      return OutputContract.fromJson(jsonOutput);
    case 2:
      return OutputMessage.fromJson(jsonOutput);
    case 3:
      return OutputChange.fromJson(jsonOutput);
    case 4:
      return OutputVariable.fromJson(jsonOutput);
    case 5:
      return OutputContractCreated.fromJson(jsonOutput);
    default:
      throw Exception('Cannot parse transaction output');
  }
}