in ,

A Flutter plugin for retrieving the device locale information

Flutter plugin for device locale

We emphasize quite often the importance and value of respecting the user’s language and geographical region when developing software applications.

A locale is a set of parameters that defines the user’s language, region, and any special variant preferences that the user wants to see in their user interface.
There are several ways to access locale information. This is a Flutter plugin for retrieving the device locale information described below.

flutter plugin

Installation

Add this to your package’s pubspec.yaml file:

dependencies:
  flutter_device_locale: ^0.3.1

Install packages from the command line (or from your editor):

flutter pub get

Import flutter_device_locale:

import 'package:flutter_device_locale/flutter_device_locale.dart';

Usage

Retrieve the current locale:

Locale locale = await DeviceLocale.getCurrentLocale();

Retrieve the preferred locales:

List<Locale> preferredLocales = await DeviceLocale.getPreferredLocales();

GitHub

https://github.com/bratan/flutter_device_locale

Written by James

Map location picker component for flutter based on google maps flutter

A flutter flip card