decode method
Decodes a JSON-compatible wire value.
Implementation
@override
ElicitationContentValue decode(Object? value) {
if (value is String) {
return ElicitationContentValueString(decodeAcpString(value));
}
try {
return ElicitationContentValueInteger(decodeAcpInt64(value));
} on Object {
// Try the next structurally distinct member.
}
if (value is num) {
return ElicitationContentValueNumber(decodeAcpNumber(value));
}
if (value is bool) {
return ElicitationContentValueBoolean(decodeAcpBoolean(value));
}
if (value is List<Object?>) {
try {
return ElicitationContentValueStringArray(
List<String>.unmodifiable(value.map((item) => decodeAcpString(item))),
);
} on Object {
// Try the next array-shaped member.
}
}
throw const FormatException('Value does not match ElicitationContentValue');
}