getIdFromEncoding function

int getIdFromEncoding(
  1. Encoding type
)

Gets the type id of the Encoding by the type

Implementation

int getIdFromEncoding(Encoding type) {
  switch (type.runtimeType) {
    case Latin1Codec:
      return EncodingBytes.latin1;
    case UTF16LE:
      return EncodingBytes.utf16;
    case UTF16BE:
      return EncodingBytes.utf16be;
    case Utf8Codec:
      return EncodingBytes.utf8;
    default:
      throw UnimplementedError('Encoding type $type is not implemented yet');
  }
}