HWNumberFormat class sealed
How a number is rendered by HWText.number and HWText.fixedNumber.
Every variant is const, so it can live inside a @HomeWidget(...)
annotation. Formatting happens natively at render time in the device's
current locale, so the same widget follows a language or region change
without the app writing new data.
Constructors
- HWNumberFormat.compact()
-
A short form for large numbers, e.g.
1200rendered as1.2K.constfactory - HWNumberFormat.currency({required HWCurrency currency, int? decimalDigits})
-
An amount of money in
currency, fixed or read from a data field.constfactory - HWNumberFormat.decimal({int? minimumFractionDigits, int? maximumFractionDigits, bool useGrouping})
-
A plain decimal number, e.g.
1,234.5.constfactory - HWNumberFormat.pattern(String pattern)
-
An explicit ICU
DecimalFormatpattern such as#,##0.00, with the separators and digits of the current locale.constfactory - HWNumberFormat.percent({int? minimumFractionDigits, int? maximumFractionDigits})
-
A percentage, e.g.
0.5rendered as50%.constfactory
Properties
- dataField → HWDataType?
-
The data field this format itself reads, or null when it reads none.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- helper → HWNativeHelper
-
The native function this format is rendered by.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
kotlinCall(
String doubleExpr, {required String dataExpr}) → String -
The Kotlin call formatting
doubleExpr, a non-nullDoubleexpression. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
swiftCall(
String doubleExpr, {required String dataExpr}) → String -
The Swift call formatting
doubleExpr, a non-optionalDoubleexpression, wheredataExpris the expression the widget's data class is reached through. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultFormat → const HWNumberFormat
-
The format a number renders with when none is given, and the one a plain
HWText(HWInt(...))/HWText(HWDouble(...))uses.