requiredEncodingForCharset function
Returns the Encoding that corresponds to charset.
Throws a FormatException if no Encoding was found that corresponds to
charset.
charset may not be null.
Implementation
Encoding requiredEncodingForCharset(String charset) =>
Encoding.getByName(charset) ??
(throw FormatException('Unsupported encoding "$charset".'));