iban 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

iban #

Validate IBANs

Build Status

Usage #

A simple usage example:

import 'package:iban/iban.dart';

main() {
  var iban = 'AT611904300234573201';
  if (isValid(iban)) {
    print('$iban is a valid iban');
  } else {
    print('$iban is not a valid iban');
  }
}

Iban specifications #

The iban specifications are copied from iban.js

See specifications.dart for all available countries.

Contrary to iban.js, which parses the specifications at runtime, all regular expression strings are parsed using specifications_builder.dart.

Please open an issue if you notice that my specifications are out of sync with iban.js or if you know how to build the iban for another country.

Changelog #

0.1.1 #

Thanks to https://github.com/haarts

  • do not allow ibans shorter than 2 characters (crashed on 0 characters)
  • fix formatting

0.1.0 #

  • dart 2 support

0.0.1 #

  • Initial version, created by Stagehand

example/iban_example.dart

import 'package:iban/iban.dart';

/// A simple iban example.
int main() {
  var iban = 'AT611904300234573201';
  if (isValid(iban)) {
    print('$iban is a valid iban');
  } else {
    print('$iban is not a valid iban');
  }

  return 0;
}

Use this package as a library

1. Depend on it

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


dependencies:
  iban: ^0.1.1

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:iban/iban.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
64
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Dec 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4

Health suggestions

Fix lib/src/specification_definitions.dart. (-34.69 points)

Analysis of lib/src/specification_definitions.dart reported 85 hints, including:

line 6 col 51: Avoid const keyword.

line 7 col 9: Avoid const keyword.

line 8 col 9: Avoid const keyword.

line 9 col 9: Avoid const keyword.

line 10 col 9: Avoid const keyword.

Fix lib/iban.dart. (-1 points)

Analysis of lib/iban.dart reported 2 hints:

line 19 col 26: Unnecessary new keyword.

line 25 col 21: Unnecessary new keyword.

Fix lib/src/specification.dart. (-0.50 points)

Analysis of lib/src/specification.dart reported 1 hint:

line 22 col 17: Unnecessary new keyword.

Format lib/src/helpers.dart.

Run dartfmt to format lib/src/helpers.dart.

Maintenance issues and suggestions

Use analysis_options.yaml. (-10 points)

Change the name of your package's .analysis_options file to analysis_options.yaml.

Read more about the setup of analysis-options.yaml.

The package description is too short. (-20 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <3.0.0
mod97 >=0.0.1 <1.0.0 0.1.0
Dev dependencies
test >=0.12.0 <2.0.0