decode static method
String
decode(
- List<
int> value, { - StringEncoding type = StringEncoding.utf8,
- bool allowInvalidOrMalformed = false,
Decodes a list of bytes value
into a string using the specified type
.
The type
parameter determines the decoding type to use, with UTF-8 being the default.
Returns the decoded string.
Implementation
static String decode(List<int> value,
{StringEncoding type = StringEncoding.utf8,
bool allowInvalidOrMalformed = false}) {
switch (type) {
case StringEncoding.utf8:
return utf8.decode(value, allowMalformed: allowInvalidOrMalformed);
case StringEncoding.base64:
return base64Encode(value);
case StringEncoding.base64UrlSafe:
return base64UrlEncode(value);
default:
return ascii.decode(value, allowInvalid: allowInvalidOrMalformed);
}
}