imei_validator 0.1.3

  • README.md
  • Example
  • Installing
  • Versions
  • 75

imei_validator

imei_validator is a library for checking IMEIs using the Luhn algorithm.

Installing

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

dependencies:
  imei_validator: any

If you're using the Dart Editor, choose:

Menu > Tools > Pub Install

Or if you want to install from the command line, run:

$ pub install

Now in your Dart code, you can use:

import 'package:imei_validator/imei_validator.dart';

Overview

var imei = new ImeiValidator("378282246310005");
print(imei.isValid); // true

Note: imei_validator will automatically remove any space or dashes from the string passed to it

Check Digit

You can calculate a check digit by creating a new ImeiValidator and passing in an meid (14 digits). The ImeiValidator will automatically calculate the check digit and make it available via the checkDigit getter.

var imei = new ImeiValidator("37828224631000");
print(imei.checkDigit); // 5

example/example.dart

import 'package:imei_validator/imei_validator.dart';

main(List<String> arguments) {
  String Imei = "378282246310005";

  var validator = new ImeiValidator(Imei);
  print(validator);
  int meid = 37828224631300;

  var validator2 = new ImeiValidator.Integer(meid);
  print(validator2.Imei);
  print(validator2.isValid);
  print(validator2.checkDigit);
  print(validator2.toJson());
}

Use this package as a library

1. Depend on it

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


dependencies:
  imei_validator: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:imei_validator/imei_validator.dart';
  
Version Uploaded Documentation Archive
0.1.3 Aug 30, 2018 Go to the documentation of imei_validator 0.1.3 Download imei_validator 0.1.3 archive
0.1.2 May 27, 2018 Go to the documentation of imei_validator 0.1.2 Download imei_validator 0.1.2 archive
0.1.1 May 27, 2018 Go to the documentation of imei_validator 0.1.1 Download imei_validator 0.1.1 archive
0.1.0 May 27, 2018 Go to the documentation of imei_validator 0.1.0 Download imei_validator 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:imei_validator/imei_validator.dart.

Maintenance issues and suggestions

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.3 <3.0.0
Dev dependencies
unittest >0.10.1 <0.11.0