vin_decoder 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

vin-decoder-dart #

Build Status Pub

A VIN decoding and validation library for Dart.

vin_decoder provides a simple decoding and validation library for Vehicle Identification Numbers (VINs) based on ISO 3779:2009 and World Manufacturer Identifiers (WMIs) based on ISO 3780:2009.

The decoder can be used standalone in an offline mode (the default behaviour, as per earlier versions of the API), or can be further enriched by querying additional VIN information from the NHTSA Vehicle API, such as the precise make, model, and vehicle type in extended mode.

Usage #

A simple usage example:

import 'package:vin_decoder/vin_decoder.dart';

void main() async {
  var vin = VIN(number: 'WP0ZZZ99ZTS392124', extended: true);

  print('WMI: ${vin.wmi}');
  print('VDS: ${vin.vds}');
  print('VIS: ${vin.vis}');

  print("Model year is " + vin.modelYear());
  print("Serial number is " + vin.serialNumber());
  print("Assembly plant is " + vin.assemblyPlant());
  print("Manufacturer is " + vin.getManufacturer());
  print("Year is " + vin.getYear().toString());
  print("Region is " + vin.getRegion());
  print("VIN string is " + vin.toString());

  // The following calls are to the NHTSA DB, and are carried out asynchronously
  var make = await vin.getMakeAsync();
  print("Make is ${make}");

  var model = await vin.getModelAsync();
  print("Model is ${model}");

  var type = await vin.getVehicleTypeAsync();
  print("Type is ${type}");
}

which produces the following:

WMI: WP0
VDS: ZZZ99Z
VIS: TS392124
Model year is T
Serial number is 92124
Assembly plant is S
Manufacturer is Porsche
Year is 1996
Region is EU
VIN string is WP0ZZZ99ZTS392124
Make is Porsche
Model is 911
Type is Passenger Car

Features and bugs #

Please file feature requests and bugs at the issue tracker.

License #

Licensed under the terms of the Apache 2.0 license, the full version of which can be found in the LICENSE file included in the distribution.

0.1.1 #

  • Fix up manufacturer lookup for unknown WMIs

0.1.0 #

  • Extend decoder to optionally query the NHTSA Vehicle API to provide make, model, and vehicle type information.
  • Elaborate dartdoc comments and documentation

0.0.1+1 #

  • Restrict the meta package version to 1.1.6 to match the Flutter SDK limitations.

0.0.1 #

  • Initial version

example/vin_decoder_example.dart

import 'package:vin_decoder/vin_decoder.dart';

void main() async {
  var vin = VIN(number: 'WP0ZZZ99ZTS392124', extended: true);

  print('WMI: ${vin.wmi}');
  print('VDS: ${vin.vds}');
  print('VIS: ${vin.vis}');

  print("Model year is " + vin.modelYear());
  print("Serial number is " + vin.serialNumber());
  print("Assembly plant is " + vin.assemblyPlant());
  print("Manufacturer is " + vin.getManufacturer());
  print("Year is " + vin.getYear().toString());
  print("Region is " + vin.getRegion());
  print("VIN string is " + vin.toString());

  // The following calls are to the NHTSA DB, and are carried out asynchronously
  var make = await vin.getMakeAsync();
  print("Make is ${make}");

  var model = await vin.getModelAsync();
  print("Model is ${model}");

  var type = await vin.getVehicleTypeAsync();
  print("Type is ${type}");
}

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

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

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

line 103 col 7: DO use curly braces for all flow control structures.

line 105 col 7: DO use curly braces for all flow control structures.

Format lib/src/nhtsa_model.dart.

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

Maintenance suggestions

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
basic_utils ^2.0.1 2.3.4
http ^0.12.0+2 0.12.0+2
meta ^1.1.6 1.1.8
Transitive dependencies
asn1lib 0.5.14
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
http_parser 3.1.3
json_annotation 3.0.0
logging 0.11.3+2
path 1.6.4
pedantic 1.8.0+1
pointycastle 1.0.2
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.0.0