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
- Object
- Measurement<
Length> - Length
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
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- 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 - 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 thisMeasurement
. [...]inherited -
compareTo(
Length other) → int -
Compares this
Measurement
toother
, 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
byother
and returns the result as a new object ofT
.inherited -
operator +(
Length other) → Length -
Adds this
Measurement
andother
and returns the sum as a new object ofT
.inherited -
operator -(
Length other) → Length -
Subtracts
other
from thisMeasurement
and returns the difference as a new object ofT
.inherited -
operator /(
double other) → Length -
Divides this
Measurement
byother
and returns the result as a new object ofT
.inherited -
operator <(
Length other) → bool -
Returns
true
if the value of thisMeasurement
is less than the value ofother
.inherited -
operator <=(
Length other) → bool -
Returns
true
if the value of thisMeasurement
is less than or equal to the value ofother
.inherited -
operator ==(
dynamic other) → bool -
Returns
true
if this Measurement has the same value asother
.inherited -
operator >(
Length other) → bool -
Returns
true
if the value of thisMeasurement
is greater than the value ofother
.inherited -
operator >=(
Length other) → bool -
Returns
true
if the value of thisMeasurement
is greater than or equal to the value ofother
.inherited -
operator unary-(
) → Length -
Returns a new object of
T
representing thisMeasurement
negated. [...]inherited