cpf_utility

Creator: coderz1093

Last updated:

0 purchases

cpf_utility Image
cpf_utility Images

Languages

Categories

Add to Cart

Description:

cpf utility

CPF Utility #
A simple package that provides CPF utilities.
A CPF is an 11 digit number which is the Brazilian individual identity number.
Example of a formatted CPF: 321.524.051-37
Usage #
To generate a valid CPF simply:
String myCpf = Cpf.generate();
copied to clipboard
If you want to generate a valid CPF from a given Brazilian state you can use the State enum:
String myCpf = Cpf.generate(state: States.sp);
copied to clipboard
The CPF comes formatted by default, you can make it unformatted:
String myCpf = Cpf.generate(formatted: false);
copied to clipboard
If you have an unformatted CPF and want to format it:
String myCpf = Cpf.generate(formatted: false); // 32152405137
String formattedCpf = Cpf.format(myCpf); // 321.524.051-37
copied to clipboard
Or maybe you want to strip your formatted CPF:
String unformattedCpf = Cpf.strip(formattedCpf); // 32152405137
copied to clipboard
And you can validate a formatted or unformatted CPF:
if (validateCpf(myCpf)) {
print("CPF is valid");
} else {
print("CPF isn't valid");
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.