fromJson static method

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

Implementation

static Output fromJson(Map<String, dynamic> jsonOutput) {
  try {
    int outputType = jsonOutput['type'];
    switch (outputType) {
      case 0:
        return OutputCoin.fromJson(jsonOutput);
      case 1:
        return OutputContract.fromJson(jsonOutput);
      case 2:
        return OutputChange.fromJson(jsonOutput);
      case 3:
        return OutputVariable.fromJson(jsonOutput);
      case 4:
        return OutputContractCreated.fromJson(jsonOutput);
      default:
        return UnknownOutput(raw: jsonOutput);
    }
  } catch (e) {
    return UnparsedOutput(raw: jsonOutput, err: e);
  }
}