decode method

String decode (
  1. List<int> bytes,
  2. {bool? allowInvalid}
)
override

Decodes the ASCII bytes (a list of unsigned 7-bit integers) to the corresponding string.

If bytes contains values that are not in the range 0 .. 127, the decoder will eventually throw a FormatException.

If allowInvalid is not provided, it defaults to the value used to create this AsciiCodec.

Implementation

String decode(List<int> bytes, {bool? allowInvalid}) {
  if (allowInvalid ?? _allowInvalid) {
    return const AsciiDecoder(allowInvalid: true).convert(bytes);
  } else {
    return const AsciiDecoder(allowInvalid: false).convert(bytes);
  }
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-convert/AsciiCodec/decode.html