Skip to content
pubscout

flutter_charset_detector

6.0.0, released 6 months ago by madlon-kay.com

Detect and decode the character encoding of text bytes automatically.

WASM-ready
$ flutter pub add flutter_charset_detector
Source repository

What it does

It automatically analyzes raw text bytes of unknown character sets and decodes them into readable strings. The package relies on native Mozilla universal charset detection libraries across platforms.

AI-written summary of version 6.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to read text files with unknown or mixed encodings.
  • You are handling raw bytes from network requests or file inputs where the charset is not specified.

Skip it when

  • You already know the exact charset of the text bytes you are trying to decode.
  • You only need standard UTF-8 parsing.

Strengths

  • Supports multiple platforms including Android, iOS, macOS, and Web.
  • Automatically determines character sets using proven Mozilla-derived libraries.

Weaknesses

  • Detection accuracy depends on the underlying native libraries and input size.
  • Detectable charsets differ slightly between platforms.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
4

Web requires TextDecoder support. Other platforms require no special setup.

import 'package:flutter_charset_detector/flutter_charset_detector.dart';

Uint8List bytes = getBytes();
DecodingResult result = CharsetDetector.autoDecode(bytes);
print(result.charset);
print(result.string);

Alternatives

Packages that do the same job and could replace flutter_charset_detector.