Short class

A wrapper class for int representing a 16-bit signed integer.

This class wraps a short integer value and provides Java-like functionality similar to Java's Short class.

Example usage:

Short s1 = Short(32767);
Short s2 = Short.parseShort("1000");
Short s3 = Short.valueOf(-32768);

print(s1.toString()); // "32767"
print(s1.toUnsigned()); // 32767
Implemented types

Constructors

Short(int value)
Creates a Short with the specified value.

Properties

hashCode int
Returns the hash code for this Short.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value int
Returns the wrapped short value.
no setter

Methods

abs() Short
Returns the absolute value of this Short.
compareTo(Short other) int
Compares this Short with another Short.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of this Short.
override
toUnsigned() int
Returns the unsigned representation of this short (0-65535).

Operators

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

Static Methods

parseShort(String str, [int radix = 10]) Short
Parses a string to a Short.
valueOf(int value) Short
Returns a Short instance representing the specified int value.

Constants

MAX_VALUE → const int
Maximum value for a signed short
MIN_VALUE → const int
Minimum value for a signed short