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

ec_validator demo

Documentation

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

ec_validator form_dni

Demo form valid RUC

ec_validator form_ruc

Running Tests

To run tests, run the following command

  flutter test

License

LICENSE

Authors