faker 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 86

faker

Build Status Coverage Status

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 usage example:

import 'package:faker/faker.dart';

main() {
  var faker = new Faker();

  faker.internet.email();
  // francisco_lebsack@buckridge.com

  faker.internet.ipv6Address();
  // 2450:a5bf:7855:8ce9:3693:58db:50bf:a105

  faker.internet.userName();
  // fiona-ward

  faker.person.name();
  // Fiona Ward

  faker.person.prefix();
  // Mrs.

  faker.person.suffix();
  // Sr.
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Copyright (c) 2015 Jesper HÃ¥kansson. See LICENSE for details. Copyright (c) 2013 Emmanuel Oga. Copyright (c) 2012 Daniele Faraglia. Copyright (c) 2007 Benjamin Curtis.

Changelog

1.0.0

  • Make faker compatible with Dart 2.0.

0.0.5

  • fix: Remove illegal chars from generated domain words

0.0.4

  • Added food generator, includes restaurants, dishes and cuisines

0.0.3

  • fix: Type faker constant to Faker

0.0.2

  • Added support for guids
  • Added fromPatternToHex method that generates a random set of numbers from a given pattern and return it as hex

0.0.1

  • Initial release

example/faker.dart

library faker.example;

import 'package:faker/faker.dart';

main() {
  // Generate some different types of data.
  print(faker.address.country());
  print(faker.company.name());
  print(faker.currency.code());
  print(faker.internet.ipv4Address());
  print(faker.job.title());
  print(faker.person.firstName());
  print(faker.sport.name());

  // Generate a random amount of IP v4 addresses (max 10).
  print(random.amount((_) => faker.internet.ipv4Address(), 10));

  // Generate random boolean.
  print(random.boolean());

  // Generate random decimal.
  print(random.decimal());
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  faker: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:faker/faker.dart';
  
Version Uploaded Documentation Archive
1.0.0 Sep 9, 2018 Go to the documentation of faker 1.0.0 Download faker 1.0.0 archive
0.0.5 Apr 16, 2017 Go to the documentation of faker 0.0.5 Download faker 0.0.5 archive
0.0.4 Oct 25, 2015 Go to the documentation of faker 0.0.4 Download faker 0.0.4 archive
0.0.3 Oct 22, 2015 Go to the documentation of faker 0.0.3 Download faker 0.0.3 archive
0.0.2 Sep 8, 2015 Go to the documentation of faker 0.0.2 Download faker 0.0.2 archive
0.0.1 Jul 9, 2015 Go to the documentation of faker 0.0.1 Download faker 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
86
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:faker/faker.dart.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.2.0