Long class

A wrapper class for large integers that provides Java-like functionality.

This class wraps Dart's int type but is designed for large integer values, similar to Java's Long class.

Example usage:

Long a = Long(9223372036854775807);
Long b = Long.valueOf(1000000000000);
Long c = Long.parseLong("123456789012345");

print(a.toString()); // "9223372036854775807"
print(a.compareTo(b)); // 1
Implemented types

Constructors

Long(int _value)
Creates a Long with the specified value.
const

Properties

hashCode int
Returns the hash code for this Long.
no setteroverride
isEven bool
Returns true if the value is even.
no setter
isNegative bool
Returns true if the value is negative.
no setter
isOdd bool
Returns true if the value is odd.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value int
Returns the wrapped long value.
no setter

Methods

abs() Long
Returns the absolute value of this Long.
compareTo(Long other) int
Compares this Long with another Long.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDouble() double
Returns the value as a double.
toRadixString([int? radix]) String
Returns a string representation in the specified radix.
toString() String
Returns a string representation of this Long.
override

Operators

operator %(Long other) Long
operator &(Long other) Long
Bitwise operators
operator *(Long other) Long
operator +(Long other) Long
Arithmetic operators
operator -(Long other) Long
operator <(Long other) bool
Comparison operators
operator <<(int shiftAmount) Long
operator <=(Long other) bool
operator ==(Object other) bool
Returns true if this Long equals the specified object.
override
operator >(Long other) bool
operator >=(Long other) bool
operator >>(int shiftAmount) Long
operator ^(Long other) Long
operator unary-() Long
operator |(Long other) Long
operator ~() Long
operator ~/(Long other) Long

Static Methods

max(int a, int b) int
Returns the larger of two int values.
min(int a, int b) int
Returns the smaller of two int values.
parseLong(String str, [int radix = 10]) Long
Parses a string to a Long.
valueOf(int value) Long
Returns a Long instance representing the specified int value.
valueOfString(String str, [int radix = 10]) Long
Returns a Long instance from a string.

Constants

MAX_VALUE → const int
Maximum value for a 64-bit signed integer
MIN_VALUE → const int
Minimum value for a 64-bit signed integer