Skip to content

alexcdever/butterfly-flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a package for generating id.

Features

This package generates 19 bytes id by timestamp and the machine number. The timestamp should be millisecond format. But the machine number just decided by what you want. The construction of id is like this:

  • timeStampSize = 41;
  • highSequenceSize = 8;
  • machineSize = 13;
  • lowSequenceSize = 1;

Usage

// get generator instance by timestamp and machine number
var generator = Butterfly(DateTime.now().millisecondsSinceEpoch, 0);
// generate one id
int id = generator.generate();
// generate specified number of ids
List<int> ids = generator.batchGenerate(10);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages