Overview
The cnpj_cpf_formatter package provides a simple and efficient way to format Brazilian CNPJ and CPF documents in Flutter applications. It automatically applies the correct mask during input, ensuring data consistency and improving user experience. The formatter supports real-time validation and can be easily integrated into text fields. Designed for developers targeting Brazilian audiences, it reduces manual formatting errors and streamlines form handling. The library is lightweight, well-documented, and actively maintained.
Use cases
- Form inputs for Brazilian business or personal IDs
- Real-time document formatting in registration forms
- Validation of CPF and CNPJ during user entry
- Enhancing UX with automatic masking
- Integrating with authentication flows
- Data consistency in financial or legal apps
Key features
- Automatic CNPJ/CPF masking
- Real-time input formatting
- Simple integration with TextFields
- Supports both CPF and CNPJ
- Lightweight and performant
- Easy setup with minimal code
Suitable for
- Flutter apps targeting Brazil
- Forms requiring CPF/CNPJ input
- Developers needing instant formatting
- Applications with strict data validation
- UX-focused input components
- Mobile apps handling legal or financial data
Considerations
- Only formats Brazilian CPF and CNPJ
- Does not validate correctness beyond format
- Requires manual validation for authenticity
- No support for international formats
- Limited to Flutter platform
- No built-in error messages