Snowflake constructor

Snowflake(
  1. int _workerId,
  2. int _datacenterId
)

Implementation

Snowflake(this._workerId, this._datacenterId) {
  if (_workerId > _maxWorkerId || _workerId < 0) {
    throw Exception(
        "worker Id can't be greater than $_maxWorkerId or less than 0");
  }
  if (_datacenterId > _maxDatacenterId || _datacenterId < 0) {
    throw Exception(
        "datacenter Id can't be greater than $_maxDatacenterId or less than 0");
  }
}