fromJson static method

Input fromJson(
  1. Map<String, dynamic> jsonInput
)

Implementation

static Input fromJson(Map<String, dynamic> jsonInput) {
  try {
    int inputType = jsonInput['type'];
    switch (inputType) {
      case 0:
        return InputCoin.fromJson(jsonInput);
      case 1:
        return InputContract.fromJson(jsonInput);
      case 2:
        return InputMessage.fromJson(jsonInput);
      default:
        return UnknownInput(raw: jsonInput);
    }
  } catch (e) {
    return UnparsedInput(raw: jsonInput, err: e);
  }
}