mocky 0.1.2 copy "mocky: ^0.1.2" to clipboard
mocky: ^0.1.2 copied to clipboard

A clean, extensible data generator for tests, demos, and mock data. Supports multiple locales (Ukrainian, US) with words, names, phone numbers, and emails.

Mocky #

A clean, extensible data generator package for tests, demos, and mock data.

Features #

  • Multi-locale support: Ukrainian (uk) and US English (us)
  • Generate random words from dictionaries of ~1000 common words per locale
  • Generate random names from dictionaries of 100 names per locale
  • Generate locale-specific phone numbers with real operator prefixes
  • Generate Gmail email addresses with locale-appropriate names/words
  • Simple, static API for easy integration
  • No external dependencies
  • Lightweight and fast

Getting started #

Add mocky to your pubspec.yaml:

dependencies:
  mocky: ^0.1.0

Then import it:

import 'package:mocky/mocky_data.dart';

Usage #

Locale selection #

Set the locale for data generation (default is Ukrainian):

// Use Ukrainian locale (default)
Mocky.setLocale(Locale.uk);

// Switch to US locale
Mocky.setLocale(Locale.us);

// Check current locale
print(Mocky.getLocale()); // Locale.us

Words #

Generate random words in the current locale:

String word = Mocky.word();
print(word); // Ukrainian: "будинок" or US: "house"

List<String> words = Mocky.words(5);
print(words); // ["дерево", "місто", "книга", "вода", "сонце"]

Names #

Generate random names in the current locale:

String name = Mocky.name();
print(name); // Ukrainian: "Олександр" or US: "James"

List<String> names = Mocky.names(5);
print(names); // ["Марія", "Андрій", "Катерина", "Дмитро", "Софія"]

Phone numbers #

Generate locale-specific phone numbers:

// Ukrainian format: +380XXXXXXXXX (13 chars)
Mocky.setLocale(Locale.uk);
String phone = Mocky.phone();
print(phone); // "+380501234567"

// US format: +1XXXXXXXXXX (12 chars)
Mocky.setLocale(Locale.us);
String phone = Mocky.phone();
print(phone); // "+12125551234"

List<String> phones = Mocky.phones(5);

Email addresses #

Generate Gmail addresses with locale-appropriate names:

String email = Mocky.email();
print(email); // Ukrainian: "oleksandr123@gmail.com" or US: "james456@gmail.com"

List<String> emails = Mocky.emails(5);

Complete example #

import 'package:mocky/mocky_data.dart';

void main() {
  // Ukrainian data
  Mocky.setLocale(Locale.uk);
  print(Mocky.word());   // "будинок"
  print(Mocky.name());   // "Олександр"
  print(Mocky.phone());  // "+380501234567"
  print(Mocky.email());  // "oleksandr123@gmail.com"

  // US data
  Mocky.setLocale(Locale.us);
  print(Mocky.word());   // "house"
  print(Mocky.name());   // "James"
  print(Mocky.phone());  // "+12125551234"
  print(Mocky.email());  // "james456@gmail.com"
}

Supported locales #

  • Ukrainian (uk): ~1000 Ukrainian words, 100 Ukrainian names, Ukrainian mobile operators (039, 050, 063, 066, 067, 068, 073, 091-099)
  • US (us): ~1000 English words, 100 American names, US area codes

Notes #

  • If you request more words or names than the dictionary size, duplicates may occur
  • Phone numbers use real operator prefixes for each locale
  • Email addresses are generated by normalizing names/words to lowercase Latin characters and adding random digits

Roadmap #

Future versions may include:

  • Additional locales (UK, Canada, etc.)
  • Company name generators
  • Seeded random generation for reproducible results
  • Word categories and pluralization
  • Address generators

Additional information #

This package is in early development. Contributions, issues, and feature requests are welcome on GitHub.

2
likes
160
points
160
downloads

Publisher

verified publisheravdonin.dev

Weekly Downloads

A clean, extensible data generator for tests, demos, and mock data. Supports multiple locales (Ukrainian, US) with words, names, phone numbers, and emails.

Repository (GitHub)
View/report issues

Topics

#fake-data #words-generator #phone-generator #email-generator #name-generator

Documentation

API reference

License

MIT (license)

More

Packages that depend on mocky