brazillian 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 49

Brazillian Data #

Build Status Coverage Status

A library for Dart that generates fake Brazillian data.

Usage #

A simple usage example:

import 'package:brazillian/brazillian.dart';

main() {
  var brazillian = new Brazillian();
  
  brazillian.cpf.generate());
  // 00000000000
  
  brazillian.cpf.generate(invalid: true);
  // 12345678912
  
  brazillian.cpf.generate(formatted: true);
  // 000.000.000-00
  
  brazillian.cpf.isValid('00000000000');
  // false
  
  brazillian.cpf.format('00000000000');
  // 000.000.000-00

  brazillian.cnpj.generate();
  // 00000000000000
  
  brazillian.cnpj.generate(invalid: true);
  // 00000000000101
  
  brazillian.cnpj.generate(formatted: true);
  // 00.000.000/0001-00
  
  brazillian.cnpj.isValid('00000000000000');
  // false
  
  brazillian.cnpj.format('00000000000000');
  // 00.000.000/0001-00
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

1.0.0 #

  • Added cpf generator
  • Added cpf validator
  • Added cpf formatter
  • Added cnpj generator
  • Added cnpj validator
  • Added cnpj formatter

example/brazillian.dart

library brazillian.example;

import 'package:brazillian/brazillian.dart';

main() {
  // [CPF]
  // Generate a valid CPF
  print(brazillian.cpf.generate());
  // Generate a invalid CPF
  print(brazillian.cpf.generate(invalid: true));
  // Generate a formatted CPF
  print(brazillian.cpf.generate(formatted: true));
  // Validates the generated CPF
  print(brazillian.cpf.isValid(brazillian.cpf.generate()));
  // Formats a generated CPF
  print(brazillian.cpf.format(brazillian.cpf.generate()));

  // [CNPJ]
  // Generate a valid CPF
  print(brazillian.cnpj.generate());
  // Generate a invalid CPF
  print(brazillian.cnpj.generate(invalid: true));
  // Generate a formatted CPF
  print(brazillian.cnpj.generate(formatted: true));
  // Validates the generated CPF
  print(brazillian.cnpj.isValid(brazillian.cnpj.generate()));
  // Formats a generated CPF
  print(brazillian.cnpj.format(brazillian.cnpj.generate()));
}

Use this package as a library

1. Depend on it

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


dependencies:
  brazillian: ^1.0.0

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:brazillian/brazillian.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs. (-1 points)

20 out of 20 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/check_digit.dart. (-1.49 points)

Analysis of lib/src/check_digit.dart reported 3 hints:

line 11 col 7: DO use curly braces for all flow control structures.

line 24 col 9: DO use curly braces for all flow control structures.

line 27 col 9: DO use curly braces for all flow control structures.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
meta ^1.1.7 1.1.8
Dev dependencies
test ^1.2.0