Length class

A unit of measurement representing a one-dimensional length.

Inheritance
Available extensions

Constructors

Length.fromCentimeters(Decimal centimeters)
Creates a Length representing the specified number of centimeters.
factory
Length.fromDecameters(Decimal decameters)
Creates a Length representing the specified number of decameters.
factory
Length.fromDecimeters(Decimal decimeters)
Creates a Length representing the specified number of decimeters.
factory
Length.fromFeet(Decimal feet)
Creates a Length representing the specified number of feet.
factory
Length.fromGigameters(Decimal gigameters)
Creates a Length representing the specified number of gigameters.
factory
Length.fromHectometers(Decimal hectometers)
Creates a Length representing the specified number of hectometers.
factory
Length.fromInches(Decimal inches)
Creates a Length representing the specified number of inches.
factory
Length.fromKilometers(Decimal kilometers)
Creates a Length representing the specified number of kilometers.
factory
Length.fromLines(Decimal lines)
Creates a Length representing the specified number of lines.
factory
Length.fromMegameters(Decimal megameters)
Creates a Length representing the specified number of megameters.
factory
Length.fromMeters(Decimal meters)
Creates a Length representing the specified number of meters.
factory
Length.fromMicrometers(Decimal micrometers)
Creates a Length representing the specified number of micrometers.
factory
Length.fromMiles(Decimal miles)
Creates a Length representing the specified number of miles.
factory
Length.fromMillimeters(Decimal millimeters)
Creates a Length representing the specified number of millimeters.
factory
Length.fromNanometers(Decimal nanometers)
Creates a Length representing the specified number of nanometers.
factory
Length.fromThous(Decimal thous)
Creates a Length representing the specified number of thous.
factory
Length.fromUnits(LengthUnit unit, Decimal value)
Creates a Length given a unit and decimal value for that unit.
Length.fromYards(Decimal yards)
Creates a Length representing the specified number of yards.
factory

Properties

baseValue ↔ Decimal
The underlying base value of the unit of measurement.
latefinalinherited
centimeters → Decimal
Gets the number of centimeters in this Length, including any fractional portion.
no setter
decameters → Decimal
Gets the number of decameters in this Length, including any fractional portion.
no setter
decimeters → Decimal
Gets the number of decimeters in this Length, including any fractional portion.
no setter
feet → Decimal
Gets the number of feet in this Length, including any fractional portion.
no setter
gigameters → Decimal
Gets the number of gigameters in this Length, including any fractional portion.
no setter
hashCode int
The hash code for this object.
no setterinherited
hectometers → Decimal
Gets the number of hectometers in this Length, including any fractional portion.
no setter
inches → Decimal
Gets the number of inches in this Length, including any fractional portion.
no setter
kilometers → Decimal
Gets the number of kilometers in this Length, including any fractional portion.
no setter
lines → Decimal
Gets the number of lines in this Length, including any fractional portion.
no setter
megameters → Decimal
Gets the number of megameters in this Length, including any fractional portion.
no setter
meters → Decimal
Gets the number of meters in this Length, including any fractional portion.
no setter
micrometers → Decimal
Gets the number of micrometers in this Length, including any fractional portion.
no setter
miles → Decimal
Gets the number of miles in this Length, including any fractional portion.
no setter
millimeters → Decimal
Gets the number of millimeters in this Length, including any fractional portion.
no setter
nanometers → Decimal
Gets the number of nanometers in this Length, including any fractional portion.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
thous → Decimal
Gets the number of thous in this Length, including any fractional portion.
no setter
yards → Decimal
Gets the number of yards in this Length, including any fractional portion.
no setter

Methods

abs() Length
Gets the absolute value.
inherited
compareTo(Length other) int
Compares this object to another object.
inherited
createValue(Decimal baseValue) Length
Creates a unit of measurement value with the specified baseValue.
override
getBaseValue(LengthUnit unit, Decimal value) → Decimal
Gets the base value for a unit of measurement of unit and value.
override
getLargestUnit({required Set<LengthUnit> permissibleUnits}) LengthUnit
Determines the largest unit that has a value of at least 1.
inherited
getUnits(LengthUnit unit) → Decimal
Gets the number of unit units in this unit of measurement.
override
humanize({String pattern = defaultValuePattern, Set<LengthUnit> permissibleValueUnits = LengthUnits.commonSi, String? locale}) String

Available on Length, provided by the LengthExtensions extension

Humanizes this Length using the specified pattern, which is forwarded to a LengthTransformation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
per(Duration period) LengthRate
Creates a LengthRate with the specified period from this value.
round(LengthUnit roundTo) Length
Rounds this unit of measurement such that the roundTo unit will be rounded towards the nearest integer.
inherited
toString() String
A string representation of this object.
override

Operators

operator *(Decimal factor) Length
Multiplies this value by factor.
inherited
operator +(Length other) Length
Adds other onto this value.
inherited
operator -(Length other) Length
Subtracts other from this value.
inherited
operator /(Decimal divisor) Length
Divides this value by divisor.
inherited
operator <(Length other) bool
Determines whether this value is less than other.
inherited
operator <=(Length other) bool
Determines whether this value is less than or equal to other.
inherited
operator ==(Object other) bool
Determines whether this unit of measurement value is equal to other.
inherited
operator >(Length other) bool
Determines whether this value is greater than other.
inherited
operator >=(Length other) bool
Determines whether this value is greater than or equal to other.
inherited
operator unary-() Length
Negates this value.
inherited

Static Properties

zero Length
A Length of size zero.
final