Skip to main content

kenteken 1.0.0 copy "kenteken: ^1.0.0" to clipboard
kenteken: ^1.0.0 copied to clipboard

Parse, validate and format Dutch licence plates (kentekens) by sidecode, and look up vehicle details, fuel data and recalls in RDW open data.

example/example.dart

import 'package:kenteken/rdw.dart';

Future<void> main(List<String> args) async {
  final plate = LicensePlate.tryParse(args.isEmpty ? '84-xx-pj' : args.first);
  if (plate == null) {
    print('That is not a Dutch licence plate.');
    return;
  }
  print('$plate (sidecode ${plate.sidecode.number})');

  final rdw = RdwClient();
  try {
    final vehicle = await rdw.vehicle(
      plate,
      include: {RdwData.fuel, RdwData.recalls},
    );
    if (vehicle == null) {
      print('RDW does not know this plate.');
      return;
    }
    print('${vehicle.make} ${vehicle.model ?? ''}, ${vehicle.vehicleType}');
    print(
      'APK expires: ${vehicle.apkExpiry?.toIso8601String().substring(0, 10) ?? 'unknown'}',
    );
    print('Fuel: ${vehicle.fuels!.map((fuel) => fuel.type).join(' + ')}');
    for (final recall in vehicle.recalls!) {
      print(
        'Recall ${recall.referenceCode} (${recall.status.name}): ${recall.defect ?? 'no details'}',
      );
    }
  } on RdwException catch (e) {
    print('Lookup failed: $e');
  } finally {
    rdw.close();
  }
}
0
likes
160
points
764
downloads

Documentation

API reference

Publisher

verified publishermommersteeg.dev

Weekly Downloads

Parse, validate and format Dutch licence plates (kentekens) by sidecode, and look up vehicle details, fuel data and recalls in RDW open data.

Repository (GitHub)
View/report issues

Topics

#netherlands #license-plate #rdw #vehicle

License

MIT (license)

Dependencies

http

More

Packages that depend on kenteken