Snowflake class Null safety
Snowflake represents id system used by Discord. id property is actual id of entity which holds Snowflake.
- Implemented types
Constructors
- Snowflake(dynamic id)
-
Creates instance of a Snowflake
factory
- Snowflake.bulk()
-
Creates first snowflake which can be deleted by
bulk-delete messages
- Snowflake.fromDateTime(DateTime date)
-
Creates synthetic snowflake based on given
date
. - Snowflake.fromNow()
- Creates synthetic snowflake based on current time
- Snowflake.value(int _id)
-
Creates new instance of Snowflake.
const
- Snowflake.zero()
-
Creates new instance with value of 0
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyoverride
- id → int
-
Full snowflake id
read-only
- isZero → bool
-
Returns true if snowflake is zero
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- timestamp → DateTime
-
Returns timestamp included in Snowflake
Snowflake reference
read-only
Methods
-
compareTo(
Snowflake other) → int -
Compares this object to another object.
override
-
isAfter(
Snowflake s) → bool -
Checks if given Snowflake
s
is created after this instance -
isBefore(
Snowflake s) → bool -
Checks if given Snowflake
s
is created before this instance -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toSnowflakeEntity(
) → SnowflakeEntity - Returns SnowflakeEntity from current Snowflake
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
dynamic other) → bool -
The equality operator.
override
Static Methods
-
compareDates(
Snowflake first, Snowflake second) → int - Compares two Snowflakes based on creation date
Constants
- discordEpoch → const int
-
START OF DISCORD EPOCH
1420070400000
- snowflakeDateOffset → const int
-
Offset of date in snowflake
1 << 22