RegionSettings class

Regional settings data.

Call RegionSettings to access device region settings including temperature unit, measurement system, and date/number format preferences.

Constructors

RegionSettings({required String locale, required TemperatureUnit temperatureUnits, required bool usesMetricSystem, required int firstDayOfWeek, required RegionDateFormats dateFormat, required RegionTimeFormats timeFormat, required RegionNumberFormats numberFormat, required String icuNumberFormat, required String decimalSeparator, required String groupSeparator})
Constructs an instance of regional settings data.

Properties

dateFormat RegionDateFormats
Date format options.
final
decimalSeparator String
The character used to separate decimal places in numbers.
final
firstDayOfWeek int
Integer denoting the first day of the week.
final
groupSeparator String
The character used to separate groups of thousands/hundreds in numbers.
final
hashCode int
The hash code for this object.
no setterinherited
icuNumberFormat String
ICU standard number format pattern.
final
locale String
The locale for the region settings.
final
numberFormat RegionNumberFormats
Number format options.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
temperatureUnits TemperatureUnit
Temperature unit options enum.
final
timeFormat RegionTimeFormats
Time format options.
final
usesMetricSystem bool
Boolean indicating if the device is set to use Metric.
final

Methods

formatDate(DateTime date, {DateStyle dateStyle = DateStyle.medium, String? forceLocale}) String
Format a date using the regional settings.
formatNumber(double number, {int? decimalPlaces, int? significantDigits, int? minimumFractionDigits, int? maximumFractionDigits, bool useGrouping = true, bool displayTrailingZeros = true, bool asPercentage = false, String? forceLocale}) String
Format a number using the regional settings.
formatTime(DateTime time, {TimeStyle timeStyle = TimeStyle.short, String? forceLocale}) String
Format a time using the regional settings.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Output regional settings as a formatted string.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getDateFormatsList() Future<List<String>>
Get the date formats from device settings.
getFirstDayOfWeek() Future<int>
Get the first day of the week from device settings.
getNumberFormatsList() Future<List<String>>
Get the number formats from device settings.
getSettings() Future<RegionSettings>
Load all available regional settings from the device settings.
getTemperatureUnits() Future<TemperatureUnit>
Get the temperature units from device settings.
getTimeFormatsList() Future<List<String>>
Get the time formats from device settings.
getUsesMetricSystem() Future<bool>
Check if device is set to use metric system.