id_gen 0.7.3 copy "id_gen: ^0.7.3" to clipboard
id_gen: ^0.7.3 copied to clipboard

A standardized and well-tested set of IDs generators: globally unique, readable, time-dependency, transitive, incremental, decremental IDs.

example/main.dart

// ignore_for_file: avoid_print

import 'package:id_gen/id_gen.dart';
import 'package:id_gen/id_gen_helpers.dart';

void main() {
  // generate random UUIDs, helper
  {
    for (var i = 0; i < 4; ++i) {
      print(genUuid);
    }
  }

  // generate random UUIDs, native
  {
    const gen = UuidGen();
    for (var i = 0; i < 4; ++i) {
      print(gen.next);
    }
  }

  // generate HID from Ukrainian
  {
    const gen = HumanIdGen(options: HumanIdGenOptions(lowerCase: true));
    final hid = gen.get('Тема статті чи назва курсу');
    print(hid);
  }

  // generate increasing unique integer ID, helper
  {
    print(TransitIdGen().get());
    // or
    print(genTransitId);
  }

  // generate decreasing unique integer ID
  {
    final gen = TransitIdGen(1050, -50);
    print(gen.get());
  }

  // generate time IDs in milliseconds, helper
  {
    for (var i = 0; i < 4; ++i) {
      print(genTimeId);
    }
  }

  // generate time IDs in microseconds, helper
  {
    for (var i = 0; i < 4; ++i) {
      print(genTimeIdMicro);
    }
  }
}
4
likes
0
pub points
54%
popularity

Publisher

verified publishersyrokomskyi.com

A standardized and well-tested set of IDs generators: globally unique, readable, time-dependency, transitive, incremental, decremental IDs.

Repository (GitHub)
View/report issues

Topics

#generator #id #uuid #time #random

License

unknown (license)

Dependencies

meta, test, uuid

More

Packages that depend on id_gen