rsa_id_number 1.0.3 copy "rsa_id_number: ^1.0.3" to clipboard
rsa_id_number: ^1.0.3 copied to clipboard

A dart utility package for validating and generating South African ID numbers.

example/example.dart

import 'dart:developer';

import 'package:rsa_id_number/rsa_id_number.dart';

void main() {
  /// Validate
  const idToValidate = '9202204720082';
  final isValid = RsaIdValidator.isValid(idToValidate);
  log('Is valid ID: $isValid');

  /// Generation a random/valid SA id number
  final rsaIdNumber = RsaIdGenerator.generate();
  log('Generated ID: $rsaIdNumber');

  /// generate with options
  final rsaIdNumber2 = RsaIdGenerator.generate(
    gender: Gender.FEMALE,
    citizenship: Citizenship.CITIZEN_BORN,
    maxDate: DateTime(1969),
    minDate: DateTime.now(),
  );
  log('Generated with opts: $rsaIdNumber2');

  /// Parser
  final RsaIdParser parser = RsaIdParser.parse(rsaIdNumber);

  log('Date of Birth: ${parser.dateOfBirth}');
  log('Gender: ${parser.sex}');
  log('Citizenship: ${parser.citizenship}');
  log('Is Valid: ${parser.isValid}');
}
8
likes
160
points
250
downloads

Publisher

verified publishermakhosandile.me

Weekly Downloads

A dart utility package for validating and generating South African ID numbers.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

intl, luhn_algorithm, meta

More

Packages that depend on rsa_id_number