0 purchases
br utils
BR Utils Dart #
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:
copied to clipboard
Or install it with pub cli:
dart pub add br_utils
copied to clipboard
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();
}
copied to clipboard
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
}
copied to clipboard
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
}
copied to clipboard
Authors 🧑💻 #
Henrique Nascimento (@HenriqueNas)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.