IdUtil class
ID生成器工具类
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getDataCenterId(
int maxDatacenterId) → Future< int> -
获取数据中心ID
数据中心ID依赖于本地网卡MAC地址。 -
getWorkerId(
int datacenterId, int maxWorkerId) → int -
获取机器ID,使用进程ID配合数据中心ID生成
机器依赖于本进程ID或进程名的Hash值。 -
nanoId(
) → String - 获取随机NanoId
-
snowflake(
{int? workerId, int? datacenterId}) → Future< Snowflake> - 获取雪花算法
-
snowflakeSync(
{int? workerId, required int datacenterId}) → Snowflake - 获取雪花算法
-
uuid(
[bool isSecure = true]) → String - 生成uuid