payloadString property

String payloadString
inherited

The payload of this CoAP message in string representation.

Implementation

String get payloadString {
  final payload = this.payload;
  if (payload.isNotEmpty) {
    try {
      final ret = utf8.decode(payload);
      return ret;
    } on FormatException catch (_) {
      // The payload may be incomplete, if so and the conversion
      // fails indicate this.
      return '<<<< Payload incomplete >>>>>';
    }
  }
  return '';
}