Length class

A length Measurement - for example 55.67 metres.

To create a new Length object, use any of this class's factory constructors. For example,

Length heightOfEverest = Length.fromKilometres(8.848);

Use one of the properties, such as inMetres, to retrieve the double value of the Length in the specified length unit. For example,

Length heightOfEverest = Length.fromKilometres(8.848);
assert(heightOfEverest.inMetres == 8848.0);

This class provides a collection of arithmetic and comparison operators.

See Measurement for the collection of arithmetic and comparison operators which this class provides.

Inheritance

Constructors

Length.fromCentimetres(double centimetres)
Returns a new Length object from the number of centimetres.
const
Length.fromFeet(double feet)
Returns a new Length object from the number of feet.
const
Length.fromInches(double inches)
Returns a new Length object from the number of inches.
const
Length.fromKilometres(double kilometres)
Returns a new Length object from the number of kilometres.
const
Length.fromMetres(double metres)
Returns a new Length object from the number of metres.
const
Length.fromMicrometres(double micrometres)
Returns a new Length object from the number of nanometres.
const
Length.fromMiles(double miles)
Returns a new Length object from the number of miles.
const
Length.fromMillimetres(double millimetres)
Returns a new Length object from the number of millimetres.
const
Length.fromNanometres(double nanometres)
Returns a new Length object from the number of nanometres.
const
Length.fromNauticalMiles(double nauticalMiles)
Returns a new Length object from the number of nautical miles.
const
Length.fromYards(double yards)
Returns a new Length object from the number of yards.
const

Properties

inCentimetres → double
Returns the total number of centimetres making up this Length.
read-only
inFeet → double
Returns the total number of feet making up this Length.
read-only
inInches → double
Returns the total number of inches making up this Length.
read-only
inKilometres → double
Returns the total number of kilometres making up this Length.
read-only
inMetres → double
Returns the total number of metres making up this Length.
read-only
inMicrometres → double
Returns the total number of micrometres making up this Length.
read-only
inMiles → double
Returns the total number of miles making up this Length.
read-only
inMillimetres → double
Returns the total number of millimetres making up this Length.
read-only
inNanometres → double
Returns the total number of nanometres making up this Length.
read-only
inNauticalMiles → double
Returns the total number of nautical miles making up this Length.
read-only
inYards → double
Returns the total number of yards making up this Length.
read-only
hashCode → int
The hash code for this object. [...]
read-only, inherited
isNegative → bool
Returns whether this Measurement is negative.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

abs() Length
Returns a new object of T representing the absolute value of this Measurement. [...]
inherited
compareTo(Length other) → int
Compares this Measurement to other, returning zero if the values are equal. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator *(double other) Length
Multiples this Measurement by other and returns the result as a new object of T.
inherited
operator +(Length other) Length
Adds this Measurement and other and returns the sum as a new object of T.
inherited
operator -(Length other) Length
Subtracts other from this Measurement and returns the difference as a new object of T.
inherited
operator /(double other) Length
Divides this Measurement by other and returns the result as a new object of T.
inherited
operator <(Length other) → bool
Returns true if the value of this Measurement is less than the value of other.
inherited
operator <=(Length other) → bool
Returns true if the value of this Measurement is less than or equal to the value of other.
inherited
operator ==(dynamic other) → bool
Returns true if this Measurement has the same value as other.
inherited
operator >(Length other) → bool
Returns true if the value of this Measurement is greater than the value of other.
inherited
operator >=(Length other) → bool
Returns true if the value of this Measurement is greater than or equal to the value of other.
inherited
operator unary-() Length
Returns a new object of T representing this Measurement negated. [...]
inherited