Length class

A unit of measurement representing a one-dimensional length.

Inheritance

Constructors

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

Properties

baseValue ↔ Rational
The underlying base value of the unit of measurement.
latefinalinherited
centimeters → Rational
Gets the number of centimeters in this Length, including any fractional portion.
no setter
decameters → Rational
Gets the number of decameters in this Length, including any fractional portion.
no setter
decimeters → Rational
Gets the number of decimeters in this Length, including any fractional portion.
no setter
feet → Rational
Gets the number of feet in this Length, including any fractional portion.
no setter
gigameters → Rational
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 → Rational
Gets the number of hectometers in this Length, including any fractional portion.
no setter
inches → Rational
Gets the number of inches in this Length, including any fractional portion.
no setter
kilometers → Rational
Gets the number of kilometers in this Length, including any fractional portion.
no setter
megameters → Rational
Gets the number of megameters in this Length, including any fractional portion.
no setter
meters → Rational
Gets the number of meters in this Length, including any fractional portion.
no setter
micrometers → Rational
Gets the number of micrometers in this Length, including any fractional portion.
no setter
miles → Rational
Gets the number of miles in this Length, including any fractional portion.
no setter
millimeters → Rational
Gets the number of millimeters in this Length, including any fractional portion.
no setter
nanometers → Rational
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 → Rational
Gets the number of thous in this Length, including any fractional portion.
no setter
yards → Rational
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(Rational baseValue) Length
Creates a unit of measurement value with the specified baseValue.
override
getBaseValue(LengthUnit unit, Rational value) → Rational
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) → Rational
Gets the number of unit units in this unit of measurement.
override
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 *(Rational 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 /(Rational 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