Generate random data(string, integer, IPs etc...) using Dart.

Overview

Mock Data Logo
Build Status License Version
Generate random data using Dart

Features

API provides generation of:

  • Integers in any range of numbers
  • Strings with various characters and length
  • Colors represented with needed color space
  • Dates between different moments in time
  • Names such as John or Mary
  • UUIDv4 and Timestamp-first UUIDs
  • URLs with many fragments
  • IPv4 and IPv6
  • Locations as either random points or in specified radius

Usage

A simple usage example:

import 'package:mock_data/mock_data.dart';

main() {

  mockName();           // Generate male or female first name. 
  mockName('male');     // Generate male first name. 
  mockName('female');   // Generate female first name. 

  mockInteger(1, 6);    // Generate integer in range from 1 do 6.

  mockString(16);       // Generate string of length 16.
  
  mockIPv4();           // Generate IPv4 represented with 
                        // format(default is '*.*.*.*') as String. 
  
  mockIPv6();           // Generate IPv6, same usage as with IPv4.

  mockColor('hex');     // Generate color represented in hex format.
  mockColor('rgb');     // Generate color represented in RGB format.
  
  mockUUID();           // Generate UUIDv4
  
  mockLocation();       // Generate random location.
  mockLocation(53.55, 108.14, 1000); // Generate random location in 1000 m radius from the specified coordinates.
  
}

These are some basic examples. There are many more methods and they all support tweeking of parameters to suit you in generating random data. By reading examples you can learn more about functionality and usage of mock_data

Contributors

License

MIT

Comments
  • Added new color spaces, names and minor bug fix mockname

    Added new color spaces, names and minor bug fix mockname

    Changed the function for throwing exception in mockName funciton. In mockName.

    !('female'.contains(gender))

    cannot be used as then they can input some random words like mal, fem, emal etc Added 35 names in male set and female set. Added 3 new color spaces in mockColor functions. I added those in README.md file. Will added test cases other soon.

    opened by nagasai-b 7
  • Tests update

    Tests update

    This PR updates tests to be less flaky, fixes some typos and adds a new changelog entry.

    After my previous PR merge I saw that tests failed https://github.com/dinko-pehar/mock_data/runs/2619656817 In logs we can see that it was due to one of mockLocation tests having some conditions which aren't really guaranteed to always get the same result. So I fixed it.

    Along with that I found a few small typos in tests names, etc.

    @dinko-pehar Could you also let me know if you plan to release a null-safety update to pub.dev? Would be good to have it sort of officially available to projects, like the one I am currently working on.

    enhancement 
    opened by vbuberen 5
  • Constraint solver issue using Flutter beta channel

    Constraint solver issue using Flutter beta channel

    There seems to be an issue with regards to the constraint solving. Would it be possible to bump down the lower version constraint to 2.0.0?

    The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297. Because ~ depends on mock_data >=1.0.1 which requires SDK version >=2.1.0 <3.0.0, version solving failed.

    enhancement 
    opened by rcagantas 4
  • Added mock_currency feature and support for last name in mock_name

    Added mock_currency feature and support for last name in mock_name

    Added mock_currency feature and in mock_name implemented the ability to display a full name. Let me know your thoughts, I will make changes accordingly so that we can merge.

    opened by nagasai-b 2
  • Null safety

    Null safety

    We use this package on one of projects and would love to see it supporting sound null safety.

    In this PR I did a migration and updated some dev dependencies. Additionally changed major version as it is suggested by Flutter team for null safety migration.

    opened by vbuberen 1
  • Add notification to Telegram on builds

    Add notification to Telegram on builds

    It would be nice to have some sort of notification when build is triggered. I have chosen Telegram for this.

    Actions should notify me on Telegram whether the build was successful or if it failed.

    enhancement 
    opened by dinko-pehar 1
  • Improve unit tests

    Improve unit tests

    mockData currently has unit tests, but they are not complete. Complete tests by adding missing tests for some sections, test for throws and generally rethink about improving testing step.

    enhancement good first issue 
    opened by dinko-pehar 1
Owner
Dinko Pehar
:tennis: :dart: :bicyclist: :book:
Dinko Pehar
Dart's native integers in custom bitwidth integer format

Dart's native integers in custom bit-width formats like i2, i4, i8, i16, i32, ix and u1, u2, u4, u8, u16, u32, ux...

Aldrin's Art Factory 2 Oct 30, 2022
Flutter Cool Random User Generate 🔥🔥

Flutter Cool Random User Generate ????

Hmida 8 Sep 10, 2022
generate massive amounts of fake data in dart and flutter

generate massive amounts of fake data in Dart & Flutter Faker.dart is a dart port of the famous faker.js package for the web and NodeJS ?? Usage faker

Cas van Luijtelaar 26 Nov 28, 2022
A simple Flutter / Dart Utility class for converting complex objects to uri and query string

A simple Flutter / Dart Utility class for converting complex or nested objects to uri and query strings you can follow the the article on how this cla

Opata Joshua 5 Sep 7, 2022
The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs. Inspired by SwiftGen. Motivation Using asset path str

FlutterGen 1.1k Jan 6, 2023
An alternative random library for Dart.

Randt Randt library for Dart... Description Use Randt to get a random integer from a list, generate random integer in a specific range and generate ra

Bangladesh Coding Soldierz 3 Nov 21, 2021
Dart package for random strings and numbers, with weights

randomness Dart package for random strings and numbers, with weights Random strings, numbers. RNG with weights. Cryptographically secure options. Gett

null 2 Aug 6, 2022
Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight.

SRA - Some Random Api Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight. Getting started Add the package

Yakiyo 3 Jan 4, 2023
apps random

flutter_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Tajul Aulia Muda 1 Oct 21, 2021
Random color generator for Flutter

Random color generator Pub link: https://pub.dartlang.org/packages/random_color This library will generate random colors that are visually pleasing an

Luka Knezic 56 Jun 13, 2022
Simple library for generating random ascii strings

random_string Simple library for generating random ascii strings. Design goals and limitations While this package provides randomBetween for convenien

Damon Douglas 24 Nov 19, 2022
Provides API to generate Dart source code

DartWriter DartWriter provides API to generate Dart source code. It can make your job easier while developing flutter/dart tools. You can also generat

Ahmet ÇELİK 11 Oct 24, 2022
A CLI tool to help generate dart classes from json returned from API

Json 2 Dart Command line utility Important note There is already a package called json2dart so this package will be called json2dartc ! This project w

Adib Mohsin 38 Oct 5, 2022
Automatically generate usecase classes from your repository class definition in Dart and Flutter

Repo Case Automatically generate usecase classes from your repository class definition in Dart and Flutter. Check out the official guide on repo_case

Sandro Maglione 5 Jul 30, 2022
An http request client, which supports Manageable Requests Cancellation, Request Policy (Timeout and Retry), Easier Multipart Requests, etc.

A wrapper around Dart's http package, which supports Manageable Requests Cancellation, Request Policy (Timeout and Retry), Easier Multipart Requests, Error Handling, etc.

Iandi Santulus 5 Oct 10, 2021
Generate gherkin automated tests

flutter_gherkin_automated Generate gherkin automated tests Preliminary: integration tests performance vs. development Original flutter_gherkin BDD tes

Vladimir E. Koltunov 5 Jul 7, 2022
A simple command-line application to generate simple folder and file structure for Flutter Applications

Kanza_cli is a simple command line tool to generate folder and file structure for your Flutter apps. To use it, you should do the followings: 1. First

Kanan Yusubov 9 Dec 16, 2022
A Dart package to web scraping data from websites easily and faster using less code lines.

Chaleno A flutter package to webscraping data from websites This package contains a set of high-level functions that make it easy to webscrap websites

António Nicolau 30 Dec 29, 2022
A library for Dart that generates fake data

faker A library for Dart that generates fake data. faker is heavily inspired by the Python package faker, and the Ruby package ffaker. Usage A simple

Jesper HÃ¥kansson 193 Dec 18, 2022