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.

Implementers

Constructors

HWNumberFormat.compact()
A short form for large numbers, e.g. 1200 rendered as 1.2K.
const
factory
HWNumberFormat.currency({required HWCurrency currency, int? decimalDigits})
An amount of money in currency, fixed or read from a data field.
const
factory
HWNumberFormat.decimal({int? minimumFractionDigits, int? maximumFractionDigits, bool useGrouping})
A plain decimal number, e.g. 1,234.5.
const
factory
HWNumberFormat.pattern(String pattern)
An explicit ICU DecimalFormat pattern such as #,##0.00, with the separators and digits of the current locale.
const
factory
HWNumberFormat.percent({int? minimumFractionDigits, int? maximumFractionDigits})
A percentage, e.g. 0.5 rendered as 50%.
const
factory

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-null Double expression.
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-optional Double expression, where dataExpr is 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.