getByName method Null safety

Encoding? getByName (
  1. String? name
)

Returns an Encoding for a named character set.

The names used are the IANA official names for the character set (see IANA character sets). The names are case insensitive.

If character set is not supported null is returned.

Implementation

static Encoding? getByName(String? name) {
  if (name == null) return null;
  return _nameToEncoding[name.toLowerCase()];
}