unwrap method
Checks the response code and throws McuException on error. Otherwise, simply returns this message.
Implementation
Future<Message> unwrap() {
return then(
(value) {
final rcValue = value.data[CborString("rc")];
if (rcValue is CborInt) {
final rc = rcValue.toInt();
if (rc != 0) {
throw McuException(rc);
}
}
return value;
},
);
}