Identifier class abstract
An identifier of something, represented as String
, int
or BigInt
.
- Implemented types
Constructors
- Identifier.new()
-
Default
const
constructor to allow extending this abstract class.const - Identifier.from(Object id)
-
An identifier from
id
that MUST be eitherString
,int
orBigInt
.factory - Identifier.fromBigInt(BigInt id)
-
An identifier from
id
of the typeBigInt
.factory - Identifier.fromInt(int id)
-
An identifier from
id
of the typeint
.factory - Identifier.fromString(String id)
-
An identifier from
id
of the typeString
.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isBigInt → bool
-
True if this value is stored as
BigInt
.no setterinherited - isInt → bool
-
True if this value is stored as
int
.no setterinherited - isInteger → bool
-
True if this value is stored as an integer (
int
orBigInt
) value.no setterinherited - 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 -
Returns this value as a
BigInt
value.inherited -
asInt(
) → int -
Returns this value as a
int
value.inherited -
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? -
This value as a
BigInt
value or null if cannot be converted toBigInt
.inherited -
tryAsInt(
) → int? -
This value as a
int
value or null if cannot be converted toint
.inherited -
tryAsString(
) → String? -
This value as a
String
value or null if cannot be converted toString
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
idOrNull(
Object? id) → Identifier? -
Prepares a nullable Identifier instance of the given
id