Skip to content
pubscout

dart_odbc

6.2.2, released 5 weeks ago by slpirate.dev

Dart library for connecting to ODBC data sources and executing SQL queries.

$ flutter pub add dart_odbc
Source repository

What it does

Provides async‑first APIs to connect, run queries, fetch tables and stream large result sets via ODBC. It wraps native ODBC bindings using ffi and supports both isolate‑based non‑blocking and optional blocking clients.

AI-written summary of version 6.2.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to access an existing ODBC data source (SQL Server, Oracle, MySQL, PostgreSQL, etc.) from Dart/Flutter
  • You require streaming of large query results without loading everything into memory
  • You want a single cross‑platform client that works on Windows, macOS and Linux

Skip it when

  • You target mobile platforms only and prefer pure Dart SQLite solutions
  • You need a high‑level ORM or code‑generated data models
  • You cannot add native ffi dependencies or need pure Dart without native libraries

Strengths

  • Cross‑platform ODBC support via ffi
  • Non‑blocking isolate implementation by default
  • Prepared statements and cursor‑based streaming
  • Direct access to native ODBC functions for advanced use cases

Weaknesses

  • Requires native ODBC driver manager installed on the target system
  • Limited to platforms where ffi is available (no web)
  • No built‑in ORM or code‑generation features

Setup

Kind
FFI (native library)
Effort
Medium
Code generation
No
Direct dependencies
2

Install ODBC driver manager (e.g., unixODBC on Linux/macOS, native driver manager on Windows). Ensure the appropriate database driver is available and accessible. No build_runner needed, just add the package and import it.

import 'package:dart_odbc/dart_odbc.dart';

final odbc = DartOdbc(dsn: 'myDsn');
await odbc.connect(username: 'user', password: 'pass');
final rows = await odbc.execute('SELECT * FROM my_table');
print(rows);
await odbc.disconnect();

Alternatives

Packages that do the same job and could replace dart_odbc.

  • sqflite

    Pure Dart SQLite client for mobile and desktop, no native ODBC dependencies

  • sqlite3

    Direct SQLite bindings via ffi, suitable when SQLite is sufficient

  • drift

    Provides a higher‑level ORM‑like API on top of sqlite3 with code generation

Works with

Packages commonly used together with dart_odbc: ones it builds on, ones built on it, and its own family.