ec_validator
A library for validating Ecuadorian identification documents (ID card and RUC)."
Null-Safety, Dart 3, with zero external dependencies
iOS, Android, Linux, Mac, Web, Windows ready
Documentation
Installation
1. Depend on it
Add this to your package's pubspec.yaml
file:
dependencies:
ec_validations: '^0.0.14'
2. Install it
You can install packages from the command line:
$ pub get
..
Alternatively, your editor might support pub. Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:ec_validations/ec_validations.dart';
Usage/Examples
For complete examples, check the example
folder inside the repository
void main() {
final result = DniValidator
.isValid('0105566046');
/**
* isValid: true or false
* errorMessage: null or error string message
* typeCodeError: null or error code
*/
final resultRucPerson = RucValidator
.validateRucByType('0105566046001', TypeIdentification.rucPersonNatural);
/**
* isValid: true or false
* errorMessage: null or error string message
* typeCodeError: null or error code
*/
final resultRuc = RucValidator.validateRuc('0105566046001');
/**
* isValid: true or false
* errorMessage: null or error string message
* typeCodeError: null or error code
*/
final resultPossiblyValidRuc = RucValidator.isPossiblyValidRuc('0391034039001');
/**
* isValid: true or false
* errorMessage: null or error string message
* typeCodeError: null or error code
*/
}
Demo form valid DNI
Demo form valid RUC
Running Tests
To run tests, run the following command
flutter test
License
Authors
Libraries
- ec_validations
- entities/identification
- entities/index
- exceptions/identification_exception
- exceptions/index
- helpers/identification/algorithm10
- helpers/identification/algorithm11
- helpers/identification/init_validate
- helpers/identification/validate_code_establishment
- helpers/identification/validate_code_province
- helpers/identification/validate_third_digit
- helpers/index
- validators/dni_validator
- validators/ruc_validator