generate massive amounts of fake data in dart and flutter

Related tags

Utilities faker.dart
Overview

Pub Version Likes Pub points Pub Pub codecov

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.dart is split up into modules, where every module has a bunch of faker methods.

Basics

    final faker = Faker.instance;

    String randomName = faker.name.fullName(); // Rowan Nikolaus
    String randomHex = faker.datatype.hexaDecimal(); // 0xF74451AB

Faker.fake()

faker.dart contains a super useful generator method Faker.fake for combining faker API methods using a mustache string format.

Example:

print(faker.fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}"));
// outputs: "Marks, Dean Sr."

This will interpolate the format string with the value of methods name.lastName(), name.firstName(), and name.suffix()

supported faker methods

Module Methods
datatype number, float, datetime, string, uuid, boolean, hexaDecimal, json, list
name fullName, firstName, lastName, middleName, findName, jobTitle, gender, prefix, suffix, title, jobDescriptor, jobArea, jobType
image image, loremPicsum, lorempixel
address zipCode, city, cityPrefix, citySuffix, cityName, streetName, streetSuffix, streetPrefix, streetAddress, secondaryAddress, county, country, countryCode, state, stateAbbr, latitude, longitude, direction, cardinalDirection, ordinalDirection, nearbyGPSCoordinate, timezone
animal type, animal, dog, cat, snake, bear, lion, catecean, horse, bird, cow, fish, corocodilia, insect, rabbit
commerce color, department, productName, price, productAdjective, productMaterial, product, productDescription

💬 Localization

faker.dart currently supports 54 Locales!!!

The default language locale is set to English. if your chosen locale doesn't support specific faker data, it will fall back to the English locale.

// sets locale to german
faker.setLocale(FakerLocaleType.de);
// set the locale to your custom Locale:
final FakerLocale locale = FakerLocale(...);
faker.setCustomLocale(locale);

currently internally supported locales:

  • az
  • ar
  • cz
  • de
  • de_AT
  • de_CH
  • en
  • en_AU
  • en_AU_ocker
  • en_BORK
  • en_CA
  • en_GB
  • en_IE
  • en_IND
  • en_US
  • en_ZA
  • es
  • es_MX
  • fa
  • fi
  • fr
  • fr_CA
  • fr_CH
  • ge
  • hy
  • hr
  • id_ID
  • it
  • ja
  • ko
  • nb_NO
  • ne
  • nl
  • nl_BE
  • pl
  • pt_BR
  • pt_PT
  • ro
  • ru
  • sk
  • sv
  • tr
  • uk
  • vi
  • zh_CN
  • zh_TW

what's up next

this package is still in active development. modules are still being added:

  • company
  • database
  • date
  • finance
  • git
  • hacker
  • iban
  • internet
  • lorem
  • mersenne
  • music
  • phonenumber
  • system
  • time
  • unique
  • vehicle
  • word

👋 Get Involved

If this package is useful to you please 👍 on pub.dev and on Github. If you have any Issues, recommendations or pull requests I'd love to see them!

Comments
  • support for fake URLs

    support for fake URLs

    Hey! first of thanks for creating this package ❤️

    It would be nice to have support for generating fake URLs (ref: https://github.com/brianvoe/gofakeit#internet)

    Let me know if this can be added into the scope for the project, would love to help/contribute

    opened by Bhupesh-V 4
  • Zip Code is replacing the symbols incorrectly

    Zip Code is replacing the symbols incorrectly

    It seems the postcode is replacing the '#' with alphabet characters and no other symbols are replaced.

    Example: UK locale is configured correctly to be '??# #??' and this returns '??A B??', when it should be 'AB1 2CD'.

    opened by robin-dojo 3
  • Fix date.between

    Fix date.between

    randomDays had the unit of "days" but it was sent to Duration constructor as milliseconds which caused all the randomly generated dates to be very close to the start.

    opened by sassanh 2
  • Actually consider the provided reference

    Actually consider the provided reference

    Currently the reference provided for past and future methods are ignored. In this commit reference becomes and optional argument for these methods, when provided it will be respected, when not provided it will default to DateTime.now().

    opened by sassanh 2
  • ✨ support for internet module

    ✨ support for internet module

    Hey, apologies for the delayed PR 😅

    have added a bunch of methods

    1. Get a fake domain name
    2. Get fake domain suffix
    3. Get a fake URL
    4. Get a fake HTTP method
    5. Get a fake IPv4 address

    this resolves #1 Let me know if anything else is needed

    opened by Bhupesh-V 2
  • Error when use date.between

    Error when use date.between

    When use date.between I had this error: RangeError: max must be in range 0 < max ≤ 2^32, was 0

    Example:

    final faker = Faker.instance;
    faker.date.between(DateTime(2021), DateTime(2021,  12))
    
    bug 
    opened by mdeandrea-mrmilu 1
  • Add tip to select random value from enum

    Add tip to select random value from enum

    Will be nice add this tip to get a random value of enum:

    enum TypeProject {
      custom,
      simple,
      advanced,
      empty
    }
    
    final randomEnum = TypeProject.values[faker.datatype.number(max: TypeProject.values.length)]
    

    Maybe can be a helper method too, but with a documentation should be enough.

    opened by mdeandrea-mrmilu 1
Owner
Cas van Luijtelaar
Cas van Luijtelaar
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
Generate random data(string, integer, IPs etc...) using Dart.

Generate random data using Features API provides generation of: Integers in any range of numbers Strings with various characters and length Colors rep

Dinko Pehar 14 Apr 17, 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
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
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
Parse cron string to schedule and generate previous or next schedule item

Parse cron string to schedule and generate previous or next schedule item

Pokhodyun Alexander 2 Apr 17, 2022
Flutter Cool Random User Generate 🔥🔥

Flutter Cool Random User Generate ????

Hmida 8 Sep 10, 2022
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 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
Destiny is a new, mock-data generator for Dart/Flutter

Destiny is a new, mock-data generator for Dart/Flutter. It uses static methods couched in a destiny namespace as the API.

Aditya Kishore 11 Sep 16, 2022
A Dart build script that downloads the Protobuf compiler and Dart plugin to streamline .proto to .dart compilation.

A Dart build script that downloads the Protobuf compiler and Dart plugin to streamline .proto to .dart compilation.

Julien Scholz 10 Oct 26, 2022
Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data

Open source SDK to quickly integrate subscriptions, stop worring about code maintenance, and getting advanced real-time data. Javascript / iOS glue framework

glassfy 8 Oct 31, 2022
An example todo list back end project that uses gRPC for client-server communication and Firestore for data storage

An example todo list back end project that uses gRPC for client-server communication and Firestore for data storage

Lucas Coelho 2 Apr 18, 2022
A flutter application , that create dynamic forms from json data

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

DotCoder 1 Aug 23, 2022
Flutter get Android meta-data in AndroidManifest.xml

Flutter get Android meta-data in AndroidManifest.xml

周枇杷! 1 Mar 9, 2022
GPT-3 recipe generator for the GPT-3 Makeathon by TUM.AI. Developed by team Taste the data.

GPT-3 Makeathon by TUM.AI - Team: Taste the Data Team - Taste the Data: Carmen Heger <@stedomedo> David Stiftl <@stiftlD> Christopher Schütz <@cdschtz

Oliver Klukas 11 Dec 4, 2022
Rocket is a parsing framework for parsing binary data structures using efficient parsing algorithms

rocket Version 0.1.10 (BETA) Rocket is a parsing framework for parsing binary data structures using efficient parsing algorithms. Breaking change: The

null 5 Dec 5, 2021