diagnostic_trouble_codes 1.0.3 copy "diagnostic_trouble_codes: ^1.0.3" to clipboard
diagnostic_trouble_codes: ^1.0.3 copied to clipboard

PlatformAndroid

A clean, asynchronous Flutter wrapper around the DTC Database created by Waleed Judah (Wal33D) enabling fast local lookups of OBD-II fault codes without APIs, internet access, or custom SQL logic.

๐Ÿš— Diagnostic Trouble Codes (Flutter) #

Flutter CI pub version

A fully offline Diagnostic Trouble Code (DTC) database for Flutter.

This package provides a clean, asynchronous Flutter wrapper around the DTC Database created by Waleed Judah (Wal33D) โ€” enabling fast local lookups of OBD-II fault codes without APIs, internet access, or custom SQL logic.

The original database and definitions are maintained by Wal33D. ๐Ÿ“ฆ The dtc_codes_v0.1.0.db database is already bundled inside this package. No manual download or setup is required.

๐Ÿ”— Original Repository: https://github.com/Wal33D/dtc-database

โœจ What This Package Does #

Most diagnostic apps need to:

  • Interpret OBD-II fault codes
  • Provide descriptions instantly
  • Work offline
  • Avoid maintaining their own database logic

This package provides:

โœ… Offline SQLite DTC database โœ… Generic SAE J2012 coverage โœ… Manufacturer-specific definitions โœ… Zero CRUD required โœ… Built-in caching (LRU) โœ… Async Flutter-native API โœ… Asset-based database loading โœ… Production-safe singleton access

๐Ÿ“ฑ Platform Support #

Platform Status
Android โœ… Supported
iOS โš ๏ธ Untested
macOS โš ๏ธ Untested
Windows โš ๏ธ Untested
Linux โš ๏ธ Untested
Web โŒ Not Supported (SQLite required)

๐Ÿ“Š Database Overview #

Dataset included via the original project:

Category Count
Total Definitions 18,805
Unique DTC Codes 12,128
Generic Codes 9,415
Manufacturer Codes 9,390
Manufacturers 33
Powertrain (P) 14,821
Body (B) 1,465
Chassis (C) 985
Network (U) 1,534

๐Ÿ”— Database Compatibility #

This package follows the release lifecycle of the original Wal33D DTC Database project.

diagnostic_trouble_codes Wal33D DTC Database
1.0.x >= 0.1.0

The bundled database snapshot corresponds to Wal33D DTC Database v0.1.0.

Future package updates will primarily occur when:

  • The upstream database publishes a new release
  • Dependencies require updates
  • Wrapper code adapts to upstream structural changes

๐Ÿ“Š Example Dashboard #

DEMO UI

๐Ÿง  Why Use This Package? #

Typical implementations require:

โŒ Remote API calls โŒ Manual SQLite queries โŒ Custom schema handling โŒ Code normalization logic โŒ Manufacturer fallback logic

Diagnostic Trouble Codes provides:

  • ๐Ÿš€ Instant local lookup
  • ๐Ÿงฉ Simple Flutter integration
  • ๐Ÿง  Correct fallback behavior (manufacturer โ†’ generic)
  • โšก Cached repeated queries
  • ๐Ÿ”’ Offline reliability

๐Ÿš€ Getting Started #

- Installation #

dependencies:
  diagnostic_trouble_codes: ^1.0.0

- Initialize Database #

final db = await DiagnosticTroubleCodeDatabase.instance;

Initialization automatically:

  • Copies database from assets
  • Stores it locally
  • Opens SQLite connection

No setup required.

๐Ÿ” Basic Usage #

Lookup a Code #

final diagnosticTroubleCode = await database.getDiagnosticTroubleCode('P0420');

print('${diagnosticTroubleCode?.code}: ${diagnosticTroubleCode?.description}');

Get Description Only #

final description = await database.getDescription('P0171');

print(description);

Manufacturer-Specific Lookup #

final fordSpecific = await database.getDescription(
  'P1690',
  manufacturer: 'FORD',
);

Automatically falls back to generic definitions if unavailable.

Search Codes #

final diagnosticTroubleCodes = await database.search('oxygen', limit: 10);

for (final diagnosticTroubleCode in diagnosticTroubleCodes) {
  print('${diagnosticTroubleCode.code}: ${diagnosticTroubleCode.description}');
}

Batch Lookup #

final results = await database.batchLookup([
  'P0171',
  'P0300',
  'B0001',
]);

print(results);

Filter by Type #

final powertrainCodes = await database.getByType('P', limit: 20);

Types:

Code Meaning
P Powertrain
B Body
C Chassis
U Network

Manufacturer Codes #

final fordCodes = await database.getManufacturerCodes('FORD');

Database Statistics #

final statistics = await database.getStatistics();

print(statistics['total']);
print(statistics['type_P']);

Change Locale #

database.setLocale('en');

Changing locale automatically clears cache safely.

Close Database #

await database.close();

๐Ÿงฉ Data Model #

DiagnosticTroubleCode #

diagnosticTroubleCode.code
diagnosticTroubleCode.description
diagnosticTroubleCode.type
diagnosticTroubleCode.typeName
diagnosticTroubleCode.manufacturer
diagnosticTroubleCode.isGeneric
diagnosticTroubleCode.locale

Example:

P0420 - Catalyst System Efficiency Below Threshold

โšก Performance Features #

Built-In LRU Cache #

Repeated lookups avoid database queries:

  • Least Recently Used eviction
  • Locale-aware cache keys
  • Automatic invalidation

No configuration required.

๐Ÿ— Architecture Overview #

Flutter App
      โ†“
DiagnosticTroubleCodeDatabase
      โ†“
sqflite (SQLite)
      โ†“
dtc_codes_v0.1.0.db (Local Asset)

The database is:

  • Fully local
  • Read-only during runtime
  • Optimized with indexes

๐Ÿ”— Relationship to Original Project #

This package wraps the database created by:

๐Ÿ‘ค Waleed Judah (Wal33D) #

Original repository:

๐Ÿ‘‰ https://github.com/Wal33D/dtc-database

The original project provides:

  • Database generation
  • Source datasets
  • Python / Java / Android wrappers

This Flutter package provides:

โœ… Native Flutter integration โœ… Asset initialization โœ… Async Dart API โœ… Mobile-friendly caching

All diagnostic definitions belong to the original project.

๐Ÿงช Testing #

The package includes:

โœ… Schema validation tests โœ… Runtime behavior tests โœ… Cache validation tests โœ… SQLite FFI testing support

Run tests:

flutter test

โŒ What This Package Is Not #

This package does not:

  • Communicate with vehicles
  • Read OBD adapters
  • Implement SAE J1979 protocols
  • Replace diagnostic SDKs

It is strictly a:

๐Ÿ“š Diagnostic Trouble Code reference database

Perfect companion to OBD libraries such as Flutter OBD2.

๐ŸŽฏ Ideal Use Cases #

โœ… OBD-II mobile apps โœ… Diagnostic scanners โœ… Fleet management tools โœ… Mechanic reference apps โœ… Offline automotive tools โœ… Insurance claim validation systems

๐Ÿงญ Design Philosophy #

This package prioritizes:

  • Simplicity over abstraction
  • Offline reliability
  • Correct diagnostic behavior
  • Minimal developer friction
  • API clarity

๐Ÿ“„ License #

Package: Licensed under the Mozilla Public License 2.0.

Database & Definitions: MIT License โ€” ยฉ Waleed Judah (Wal33D)

See original repository for dataset licensing details.

๐Ÿ™Œ Credits #

Database Author: Waleed Judah (Wal33D) https://github.com/Wal33D

0
likes
150
points
194
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A clean, asynchronous Flutter wrapper around the DTC Database created by Waleed Judah (Wal33D) enabling fast local lookups of OBD-II fault codes without APIs, internet access, or custom SQL logic.

Repository (GitHub)
View/report issues

Topics

#automotive #dtc #sqlite #offline-database #flutter-plugin

License

MPL-2.0 (license)

Dependencies

flutter, path, path_provider, sqflite

More

Packages that depend on diagnostic_trouble_codes