decodeUtf32 function

String decodeUtf32(
  1. List<int> bytes, [
  2. int offset = 0,
  3. int? length,
  4. int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT,
])

Produce a String from a sequence of UTF-32 encoded bytes. The parameters allow an offset into a list of bytes (as int), limiting the length of the values be decoded and the ability of override the default Unicode replacement character. Set the replacementCharacter to null to throw an ArgumentError rather than replace the bad value.

Implementation

String decodeUtf32(List<int> bytes,
    [int offset = 0,
    int? length,
    int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT]) {
  return String.fromCharCodes(
      (Utf32BytesDecoder(bytes, offset, length, replacementCodepoint))
          .decodeRest()
          .whereType<int>());
}