flutter_device locale
a flutter plugin for retrieving the device locale information.
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();
Comments are closed.