decode static method
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.
Example:
String decodedString = StringUtils.decode([72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33]);
Implementation
static String decode(List<int> value,
[StringEncoding type = StringEncoding.utf8]) {
switch (type) {
case StringEncoding.utf8:
return utf8.decode(value);
case StringEncoding.base64:
return base64Encode(value);
default:
return ascii.decode(value);
}
}