faker_extended 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 49

Bitbucket Pipelines branch Codecov Dart Version extra_pedantic on pub.dev License

Faker is a very useful library for Dart that generates fake data. This package adds some additional generators to make life slightly easier.

Usage #

Use faker just like you always have. But wait! There's more!

import 'dart:math' as math;
import 'package:faker_extended/faker_extended.dart';
import 'package:fixnum/fixnum.dart';

void main() {
  Int32 single32a = faker.randomGenerator.int32(min: 100);                            // -- generate a single Int32 with a value of at least 100 and at most 2^32
  int   single32b = faker.randomGenerator.int(max: math.pow(2, 48), only32bit: true); // -- generate a single int with a value of at least 100 and at most 2^32

  Int64 single64a = faker.randomGenerator.int64(max: math.pow(2, 48));                // -- generate a single Int64 with a value of at least 2^32 +1 and at most 2^64
  int   single64b = faker.randomGenerator.int(max: math.pow(2, 48), only64bit: true); // -- generate a single int with a value of at least 2^32 +1 and at most 2^64

  int   singleAny = faker.randomGenerator.int(min: 100); // -- randomly generates either a 32-bit or 64-bit integer with a value of at least 100 and at most, either 2^32 or 2^64 (respectively)

  List<Int32> many32a = faker.randomGenerator.int32s(50, min: 100);                // -- generate a list containing 50 instances of Int32, each with a value of at least 100 and at most 2^32
  List<int>   many32b = faker.randomGenerator.ints(50, min: 100, only32bit: true); // -- generate a list containing 50 instances of int, each with a value of at least 100 and at most 2^32

  List<Int64> many64a = faker.randomGenerator.int64s(50, max: math.pow(2, 48));    // -- generate a list containing 50 instances of Int64, each with a value of at least 2^32 +1 and at most 2^64
  List<int>   many64b = faker.randomGenerator.ints(50, min: 100, only64bit: true); // -- generate a list containing 50 instances of int, each with a value of at least 2^32 +1 and at most 2^64

  List<int>   manyAny = faker.randomGenerator.ints(50, min: 100); // -- generate a list containing 50 instances of either a 32-bit or 64-bit integers, each with a value of at least 100 and at most, either 2^32 or 2^64 (respectively)
}

Features and bugs #

For now, please file feature requests and bugs by emailing the author

0.0.1 #

  • Initial version, created by Stagehand

example/example.dart

// ignore_for_file: unused_local_variable

import 'dart:math' as math;
import 'package:faker_extended/faker_extended.dart';
import 'package:fixnum/fixnum.dart';

void main() {
  Int32 single32a = faker.randomGenerator.int32(min: 100);                            // -- generate a single Int32 with a value of at least 100 and at most 2^32
  int   single32b = faker.randomGenerator.int(max: math.pow(2, 48), only32bit: true); // -- generate a single int with a value of at least 100 and at most 2^32

  Int64 single64a = faker.randomGenerator.int64(max: math.pow(2, 48));                // -- generate a single Int64 with a value of at least 2^32 +1 and at most 2^64
  int   single64b = faker.randomGenerator.int(max: math.pow(2, 48), only64bit: true); // -- generate a single int with a value of at least 2^32 +1 and at most 2^64

  int   singleAny = faker.randomGenerator.int(min: 100); // -- randomly generates either a 32-bit or 64-bit integer with a value of at least 100 and at most, either 2^32 or 2^64 (respectively)

  List<Int32> many32a = faker.randomGenerator.int32s(50, min: 100);                // -- generate a list containing 50 instances of Int32, each with a value of at least 100 and at most 2^32
  List<int>   many32b = faker.randomGenerator.ints(50, min: 100, only32bit: true); // -- generate a list containing 50 instances of int, each with a value of at least 100 and at most 2^32

  List<Int64> many64a = faker.randomGenerator.int64s(50, max: math.pow(2, 48));    // -- generate a list containing 50 instances of Int64, each with a value of at least 2^32 +1 and at most 2^64
  List<int>   many64b = faker.randomGenerator.ints(50, min: 100, only64bit: true); // -- generate a list containing 50 instances of int, each with a value of at least 2^32 +1 and at most 2^64

  List<int>   manyAny = faker.randomGenerator.ints(50, min: 100); // -- generate a list containing 50 instances of either a 32-bit or 64-bit integers, each with a value of at least 100 and at most, either 2^32 or 2^64 (respectively)
}

Use this package as a library

1. Depend on it

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


dependencies:
  faker_extended: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:faker_extended/faker_extended.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
1
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Health suggestions

Format lib/src/faker_extended.dart.

Run dartfmt to format lib/src/faker_extended.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
faker ^1.2.1 1.2.1
fixnum ^0.10.11 0.10.11
Dev dependencies
extra_pedantic ^1.1.1
mockito ^4.1.1
pedantic ^1.8.0+1
test ^1.9.3
test_coverage ^0.4.1