AreaFormat class

Allows an Area to be formatted.

See UnitOfMeasurementFormat for general notes on the pattern syntax, which you can combine with the AreaUnit pattern specifiers as required:

Unit Specifier
S.I. square nanometers nm²
square micrometers μm²
square millimeters mm²
square centimeters cm²
square decimeters dm²
square meters
square decameters dam²
hectares ha
square kilometers km²
square megameters Mm²
square gigameters Gm²
Imperial square thous thou²
square inches in²
square feet ft²
square yards yd²
acres ac
square miles mi²
final area = 42.hectares();

// '42ha'
final result1 = AreaFormat().format(area);

// '42 hectares'
final result2 = AreaFormat(pattern: '0.## U').format(area);

// '420,000 m²'
final result3 = AreaFormat(pattern: '###,##0.## u:m²').format(area);

See also:

Inheritance

Constructors

AreaFormat({String pattern = '0.##${UnitOfMeasurementFormat.valueUnitSymbolFormatSpecifier}', Set<AreaUnit> permissibleValueUnits = AreaUnits.commonSi, String? locale})

Properties

hashCode int
The hash code for this object.
no setterinherited
locale String?
The locale to use when formatting values.
finalinherited
pattern String
The pattern that indicates the desired output when formatting input values.
finalinherited
permissibleRateUnits Set<RateUnit>
finalinherited
permissibleValueUnits Set<AreaUnit>
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

format(Area input) String
Formats input according to the pattern and locale of this format.
inherited
getLargestUnit(Area input) AreaUnit
Determines the largest denomination of unit in input that has a value of at least 1.
override
getPatternSpecifierFor(AreaUnit valueUnit) String
Gets the pattern specifier for the given value unit.
inherited
getPermissibleRateUnits() Set<RateUnit>
Gets a set of permissible RateUnit values.
inherited
getPermissibleValueUnits() Set<AreaUnit>
Gets a set of permissible TUnit values.
inherited
getUnitName(AreaUnit unit, String locale) String
Gets the a unit name in the given locale.
inherited
getUnitQuantity(Area input, AreaUnit unit) → Rational
Determines how many units of unit the input contains, including any fractional portion.
override
getUnitSymbol(AreaUnit unit, String locale) String
Gets the a unit symbol in the given locale.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pluralizeValueUnits(String locale) bool
Determines whether value units should be pluralized. Defaults to true.
inherited
scaleToRateUnit(Area input, RateUnit rateUnit) Area
Scales input, which is assumed to be a rated unit of measurement, so that its rate is rateUnit.
override
toString() String
A string representation of this object.
inherited

Operators

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