username_generator 1.3.0
username_generator: ^1.3.0 copied to clipboard

Dart native js
Flutter Android iOS Linux macOS web Windows

A simple library for generating random and seedable username for emails or user forms

username_generator #

pub package pub points popularity likes

A simple library for generating random and seedable username for emails or user forms

Usage #

A simple usage example:

import 'package:username_generator/username_generator.dart';

/// main function to start example
void main() {
  var generator = UsernameGenerator();

  //default separator is "_" 
  generator.separator  = '_'; // optional
 
  print(generator.generateRandom());
  // limitation_virulent_1

   print(generator.generate('John'));
  // john_75

  print(generator.generate('John Doe'));
  // john_doe_6

  print(generator.generate('John Doe', hasNumbers: false));
  // john_doe

  print(generator.generate('John Doe', hasNumbers: false, prefix: 'admin', suffix: 'ops'));
  // admin_john_doe_ops

  print(generator.generate('johndoe@example.com', date: DateTime.parse('1996-01-15')));
  // johndoe_96

  print(generator.generate('johndoe@example.com', date: DateTime.parse('1996-01-15'), shortYear:false));
  // johndoe_1996

  print(
    generator.generateForName('John',
        lastName: 'Doe', adjectives: ['ready', 'happy']),
  );
  // doe_john_10_ready

  
  print(
    generator.generateForName('John',
        lastName: 'Doe', adjectives: ['ready', 'happy']),
  );
  // doe_john_10_ready

  print(
    generator.generateList('John Doe', adjectives: ['ready', 'happy'], length: 5),
  );
  // [
  // happy_doe_john_12,
  // 24_john_happy,
  // 70_ready_john,
  // 47_doe_ready,
  // ready_john_87
  // ]
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Roadmap #

trackgit-views
6
likes
110
pub points
45%
popularity

Publisher

prikeshsavla.com

A simple library for generating random and seedable username for emails or user forms

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on username_generator