faker 1.0.0

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

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]
85
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Feb 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/src/random_generator.dart. (-2.48 points)

Analysis of lib/src/random_generator.dart reported 5 hints:

line 37 col 32: Use = to separate a named parameter from its default value.

line 45 col 28: Use = to separate a named parameter from its default value.

line 45 col 40: Use = to separate a named parameter from its default value.

line 56 col 34: Use = to separate a named parameter from its default value.

line 67 col 43: Use = to separate a named parameter from its default value.

Fix lib/src/internet.dart. (-0.50 points)

Analysis of lib/src/internet.dart reported 1 hint:

line 151 col 30: Use = to separate a named parameter from its default value.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

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