Identifier class interface

An interface for an identifier of something, represented as String, int or BigInt.

As this class is defined with the class modifier interface, the class can only be implemented, but not extended. This class also provides a default implementation that allows constructing instaces of Identifier.

Implemented types
Annotations
  • @immutable

Constructors

Identifier.from(Object id)
An identifier from id that MUST be either String, int or BigInt.
const
Identifier.fromBigInt(BigInt id)
An identifier from id of the type BigInt.
const
Identifier.fromInt(int id)
An identifier from id of the type int.
const
Identifier.fromString(String id)
An identifier from id of the type String.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
isBigInt bool
True if this value is stored as BigInt.
no setteroverride
isInt bool
True if this value is stored as int.
no setteroverride
isInteger bool
True if this value is stored as an integer (int or BigInt) value.
no setteroverride
isString bool
True if this value is stored as a String.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asBigInt() BigInt
Returns this value as a BigInt value.
override
asInt() int
Returns this value as a int value.
override
asString() String
Returns this value as a String value.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
tryAsBigInt() BigInt?
This value as a BigInt value or null if cannot be converted to BigInt.
override
tryAsInt() int?
This value as a int value or null if cannot be converted to int.
override
tryAsString() String?
This value as a String value or null if cannot be converted to String.
override

Operators

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

Static Methods

idOrNull(Object? id) Identifier?
Prepares a nullable Identifier instance of the given id.