Skip to content
pubscout

devicelocale

0.9.1, released 3 months ago by spiralarm.uk

Extract locales currently defined on the device independently of app settings.

$ flutter pub add devicelocale
Source repository

What it does

Extracts the preferred languages and current device locale data directly from the underlying operating system. It allows reading language lists as strings or Flutter Locale objects and supports per-app language preferences on Android.

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

Use it when

  • You need to detect the device's system-level preferred languages and current locale.
  • You are implementing an in-app language picker that interacts with Android per-app language preferences.

Skip it when

  • You are looking for translation management, plural rules, or locale-aware formatting utilities.
  • Targeting Linux where standard preferred language APIs are absent and it falls back to current locale.

Strengths

  • Supports multiple platforms including Android, iOS, web, macOS, and Linux.
  • Provides both string-based and Flutter Locale object return types.
  • Supports Android per-app language preferences.

Weaknesses

  • Linux and POSIX environments lack a standard API for preferred languages, returning only the current locale.
  • Requires platform-specific considerations for SwiftPM on older local Xcode setups.

Setup

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

No complex configuration required beyond standard Flutter plugin installation. Android per-app language setting requires device support checks.

import 'package:devicelocale/devicelocale.dart';

List languages = await Devicelocale.preferredLanguages;
String locale = await Devicelocale.currentLocale;

Alternatives

Packages that do the same job and could replace devicelocale.

  • language_code

    Get current device language code and locale with full ISO 639-1 and ISO 639-2 dictionaries.

  • language_info_plus

    Provides a static list of world languages with ISO‑639‑1 codes and optional localized names.

  • locale_names

    Provide locale display names in various locales via extensions on Locale from dart:ui.

Works with

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