Utils library for specific Brazilian businesses
❗ 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
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();
}
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
}
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
}
- Henrique Nascimento (@HenriqueNas)