Primitive class abstract interface

A interface for a primitive value with type and null safe accessors for data.

Implementations should support accessing at least following types: String, int, BigInt, double, bool and Null.

Implemented types
Implementers

Constructors

Primitive()

Properties

hashCode int
The hash code for this object.
no setterinherited
isBigInt bool
True if this value is stored as BigInt.
no setterinherited
isBool bool
True if this value is stored as a bool.
no setter
isDouble bool
True if this value is stored as a double.
no setter
isInt bool
True if this value is stored as int.
no setterinherited
isInteger bool
True if this value is stored as an integer (int or BigInt) value.
no setterinherited
isNull bool
True if the stored value is a null object.
no setter
isNumeric bool
True if this value is stored as numeric (int, BigInt, double) value.
no setter
isString bool
True if this value is stored as a String.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asBigInt({BigInt? min, BigInt? max}) BigInt
Returns this value as a BigInt value.
override
asBool() bool
This value as a bool value.
asDouble({double? min, double? max}) double
This value as a double value.
asInt({int? min, int? max}) int
Returns this value as a int value.
override
asNum({num? min, num? max}) num
This value as a num value (either double or int).
asString() String
Returns this value as a String value.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
tryAsBigInt({BigInt? min, BigInt? max}) BigInt?
This value as a BigInt value or null if cannot be converted to BigInt.
override
tryAsBool() bool?
This value as a bool or null if cannot be converted to bool.
tryAsDouble({double? min, double? max}) double?
This value as a double or null if cannot be converted to double.
tryAsInt({int? min, int? max}) int?
This value as a int value or null if cannot be converted to int.
override
tryAsNum({num? min, num? max}) num?
This value as a num or null if cannot be converted to num.
tryAsString() String?
This value as a String value or null if cannot be converted to String.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited