personnummer 2.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 67

personnummer Build Status

Validate Swedish social security numbers.

Example #

import 'package:personnummer/personnummer.dart';

Personnummer.valid(6403273813);
//=> true

Personnummer.valid('19130401+2931');
//=> true

See test/personnummer.dart for more examples.

License #

MIT

2.1.0 #

  • Added isMale
  • Added isFemale
  • Improved format to replace the separator if it's not matching the full year.

2.0.0 #

  • Added getAge
  • Added format
  • Follows personnummer spec.

1.0.2 #

  • Fix package issue with changelog.

1.0.1 #

  • Add changelog
  • Add example
  • Use isEmpty instead of length == 0

1.0.0 #

  • Initial version

example/main.dart

import 'package:personnummer/personnummer.dart';

void main() {
  print(Personnummer.valid('INPUT'));
}

Use this package as a library

1. Depend on it

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


dependencies:
  personnummer: ^2.1.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:personnummer/personnummer.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
37
Health:
Code health derived from static analysis. [more]
95
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
67
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/personnummer.dart. (-5.36 points)

Analysis of lib/personnummer.dart reported 11 hints, including:

line 40 col 19: Unnecessary new keyword.

line 43 col 18: Unnecessary new keyword.

line 66 col 21: Unnecessary new keyword.

line 103 col 13: Unnecessary new keyword.

line 108 col 13: Unnecessary new keyword.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.3.4