butterfly_flutter 0.0.5 icon indicating copy to clipboard operation
butterfly_flutter: ^0.0.5 copied to clipboard

An id generator that referenced butterfly(a snowflake-liked id generator implemented by Java)

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);
0
likes
120
pub points
18%
popularity

Publisher

unverified uploader

An id generator that referenced butterfly(a snowflake-liked id generator implemented by Java)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on butterfly_flutter