encodingForCharset method
Implementation
Encoding encodingForCharset(String? charset, [Encoding fallback = utf8]) {
// If the charset is empty we use the encoding fallback.
if (charset == null) return fallback;
// If the charset is not empty we will return the encoding type for this charset.
return Encoding.getByName(charset) ?? fallback;
}