br_utils 0.0.3 copy "br_utils: ^0.0.3" to clipboard
br_utils: ^0.0.3 copied to clipboard

Utils library for specific Brazilian businesses

BR Utils Dart #

pub package License: MIT style: very good analysis

Utils library for specific Brazilian businesses

Installation 💻 #

❗ In order to start using brutils-dart you must have the Dart SDK installed on your machine.

Add br_utils to your pubspec.yaml:

dependencies:
  br_utils:

Or install it with pub cli:

dart pub add br_utils

Usage 📖 #

BRUtils #

import 'package:br_utils/br_utils.dart';

void main() {
  final String cpf = BRUtils.cpf.generate();
  final bool validCpf = BRUtils.cpf.isValid(cpf);
  final String cpfMask = BRUtils.cnpj.mask();

  final String cnpj = BRUtils.cnpj.generate();
  final bool validCnpj = BRUtils.cnpj.isValid(cnpj);
  final String cnpjMask = BRUtils.cnpj.mask();
}

CPF #

import 'package:br_utils/br_utils.dart';

void main() {
  // Create a new CPF instance
  final cpf = CPF('12345678909');
  print(cpf.isValid); // true
  print(cpf.unmask()); // 12345678909

  // Use CPF static methods
  print(CPF.isValidCPF('12345678909')); // true
  print(CPF.generateCPF()); // 12345678909
}

CNPJ #

import 'package:br_utils/br_utils.dart';

void main() {
  // Create a new CNPJ instance
  final cnpj = CNPJ('12345678000190');
  print(cnpj.isValid); // true
  print(cnpj.unmask()); // 12345678000190

  // Use CNPJ static methods
  print(CNPJ.isValidCNPJ('12345678000190')); // true
  print(CNPJ.generateCNPJ()); // 12345678000190
}

Authors 🧑‍💻 #

1
likes
135
pub points
0%
popularity

Publisher

unverified uploader

Utils library for specific Brazilian businesses

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on br_utils