locale_plus
2.0.0, released 6 months ago by gokberk.dev
Access native device locale data like language, country code, time zone, and number formats.
What it does
LocalePlus provides easy access to native device locale settings and data in Flutter apps. It exposes methods to retrieve information such as language code, region code, time zone identifier, first day of the week, number formatting preferences, and date format patterns. It also allows patching Flutter locales with device-specific number separators.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read native device locale settings beyond what standard Flutter localization provides.
- You need to retrieve native number grouping/decimal separators or date format patterns.
- You need to check device preferences like the metric system or 24-hour time usage.
Skip it when
- You only need cross-platform translation management without native locale data access.
- Your target platform requires unsupported legacy Flutter versions below 3.38.0.
Strengths
- Provides direct access to native device settings for time zones, separators, and date formats.
- Includes utilities for patching Flutter locale data with native number separators.
- Supports Swift Package Manager and CocoaPods on iOS.
Weaknesses
- Requires high minimum versions for Dart (>=3.10.0) and Flutter (>=3.38.0).
- Patching behaviors for specific keyboards like Samsung are limited to Android and iOS.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add the dependency to pubspec.yaml. Requires Flutter >=3.38.0 and Dart >=3.10.0.
import 'package:locale_plus/locale_plus.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final decimalSeparator = await LocalePlus().getDecimalSeparator();
runApp(const MyApp());
}Alternatives
Packages that do the same job and could replace locale_plus.
- devicelocale
If you need a simpler package specifically for reading raw device locales without extensive number/date formatting overrides.
79Compare
Works with
Packages commonly used together with locale_plus: ones it builds on, ones built on it, and its own family.
- intllocale_plus depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- plugin_platform_interfacelocale_plus depends on itReusable base class for platform interfaces of Flutter federated plugins.
- universal_iolocale_plus depends on itCross-platform dart:io implementation with browser support for HttpClient and other APIs