mrz_parser 1.0.0

mrz_parser (Dart/Flutter) #

Build Status Coverage Status

Parse MRZ (Machine Readable Zone) from identity documents. Heavily insipred by QKMRZParser.

Supported formats: #

  • TD1
  • TD2
  • TD3
  • MRV-A
  • MRV-B

Usage #

Import the package #

Add to pubspec.yaml

    mrz_parser: ^1.0.0

Parse MRZ #

final mrz = <String>[

final result = MRZParser.parse(mrz);

Authors #

License #

mrz_parser is released under a MIT License. See LICENSE for details.

[1.0.0] - First release

First release with following formats:

  • TD1
  • TD2
  • TD3
  • MRV-A
  • MRV-B


import 'package:mrz_parser/mrz_parser.dart';

void main() {
  final mrz = <String>[

  final result = MRZParser.parse(mrz);

  print(result.documentType); // 'P'
  print(result.countryCode); // 'UTO'
  print(result.surnames); // 'ERIKSSON'
  print(result.givenNames); // 'ANNA MARIA'
  print(result.documentNumber); // 'L898902C3'
  print(result.nationalityCountryCode); // 'UTO'
  print(result.birthDate); // DateTime(1974, 08, 12)
  print(; // Sex.female
  print(result.expiryDate); // DateTime(2012, 04, 15)
  print(result.personalNumber); // 'ZE184226B'
  print(result.personalNumber2); // null

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  mrz_parser: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:mrz_parser/mrz_parser.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health issues and suggestions

Document public APIs. (-0.19 points)

35 out of 36 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/mrz_string_extensions.dart. (-1 points)

Analysis of lib/src/mrz_string_extensions.dart reported 2 hints:

line 4 col 16: The value of the field '_validInput' isn't used.

line 5 col 16: The value of the field '_numeric' isn't used.

Format lib/mrz_parser.dart.

Run dartfmt to format lib/mrz_parser.dart.

Maintenance suggestions

The package description is too short. (-2 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
Dev dependencies
collection ^1.14.12
test >=0.12.42 <2.0.0
test_coverage ^0.4.0