decode method

  1. @override
AvailableCommandInput decode(
  1. Object? value
)
override

Decodes a JSON-compatible wire value.

Implementation

@override
AvailableCommandInput decode(Object? value) {
  final payload = decodeAcpObject(value);
  final tag = decodeAcpString(payload['type']);
  switch (tag) {
    case 'text':
      return AvailableCommandInputText(textCommandInputCodec.decode(payload));
    default:
      return AvailableCommandInputCustom(
        discriminator: tag,
        payload: AcpJsonObject.fromObject(payload),
      );
  }
}