Double class

A wrapper class for double that provides Java-like functionality and methods.

This class wraps Dart's primitive double type and provides additional utility methods similar to Java's Double class.

Example usage:

Double a = Double(3.14);
Double b = Double.valueOf(2.71);
Double c = Double.parseDouble("1.618");

print(a.toString()); // "3.14"
print(a.compareTo(b)); // 1 (since 3.14 > 2.71)
Implemented types

Constructors

Double(double _value)
Creates a Double with the specified value.
const

Properties

hashCode int
Returns the hash code for this Double.
no setteroverride
isFinite bool
Returns true if the value is finite.
no setter
isInfinite bool
Returns true if the value is infinite.
no setter
isNaN bool
Returns true if the value is NaN.
no setter
isNegative bool
Returns true if the value is negative.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value double
Returns the wrapped double value.
no setter

Methods

abs() Double
Returns the absolute value of this Double.
ceil() Double
Returns the ceiling of this Double.
compareTo(Double other) int
Compares this Double with another Double.
override
floor() Double
Returns the floor of this Double.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
round() Double
Rounds this Double to the nearest integer.
toInt() int
Returns the value as an int (truncated).
toString() String
Returns a string representation of this Double.
override
truncate() Double
Truncates this Double to an integer.

Operators

operator %(Double other) Double
operator *(Double other) Double
operator +(Double other) Double
Arithmetic operators
operator -(Double other) Double
operator /(Double other) Double
operator <(Double other) bool
Comparison operators
operator <=(Double other) bool
operator ==(Object other) bool
Returns true if this Double equals the specified object.
override
operator >(Double other) bool
operator >=(Double other) bool
operator unary-() Double

Static Methods

max(double a, double b) double
Returns the larger of two double values.
min(double a, double b) double
Returns the smaller of two double values.
parseDouble(String str) Double
Parses a string to a Double.
valueOf(double value) Double
Returns a Double instance representing the specified double value.
valueOfString(String str) Double
Returns a Double instance from a string.

Constants

MAX_VALUE → const double
Maximum finite value for a double
MIN_VALUE → const double
Minimum positive normal value for a double
NaN → const double
Not-a-Number value
NEGATIVE_INFINITY → const double
Negative infinity
POSITIVE_INFINITY → const double
Positive infinity