Skip to content
pubscout

flutter_langdetect

0.0.2, released 4 years ago by an unverified publisher

Detect the language of a given text using character-wise n-gram models.

$ flutter pub add flutter_langdetect
Source repository

What it does

Detects the language of provided text supporting 55 languages out of the box. It provides functions to identify the most likely language or retrieve probabilities for multiple languages.

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

Use it when

  • You need to automatically detect the language of user input text in your app.
  • You want a lightweight and fast language detection solution ported from the Python langdetect library.

Skip it when

  • You require robust support for languages outside of the supported 55 ISO 639-1 codes.

Strengths

  • Supports 55 languages out of the box.
  • Lightweight and fast character-wise n-gram model.
  • Simple API with direct detection and probability breakdown functions.

Weaknesses

  • Requires manual initialization via initLangDetect() before use.
  • License is stated as unknown in the metadata.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1

Must call await langdetect.initLangDetect() once in the application after WidgetsFlutterBinding.ensureInitialized().

import 'package:flutter/widgets.dart';
import 'package:flutter_langdetect/flutter_langdetect.dart' as langdetect;

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await langdetect.initLangDetect();
  String text = 'Hello, world!';
  final language = langdetect.detect(text);
}

Alternatives

Packages that do the same job and could replace flutter_langdetect.

Works with

Packages commonly used together with flutter_langdetect: ones it builds on, ones built on it, and its own family.