DuckDB.Dart is the native Dart API for DuckDB, enabling developers to harness the power of DuckDB in Dart-based applications across Apple, iOS, Android, Linux, and Windows platforms.
DuckDB is a high-performance analytical database system known for its speed, reliability, and ease of use. It supports a comprehensive SQL dialect, offering features such as:
For more information on DuckDB's goals and capabilities, visit the Why DuckDB page.
DuckDB.Dart is the native Dart API for DuckDB, enabling developers to harness the power of DuckDB in Dart-based applications across Apple, iOS, Android, Linux, and Windows platforms.
DuckDB is a high-performance analytical database system known for its speed, reliability, and ease of use. It supports a comprehensive SQL dialect, offering features such as:
For more information on DuckDB's goals and capabilities, visit the Why DuckDB page.
Here are some common use cases for DuckDB.Dart:
import 'package:dart_duckdb/dart_duckdb.dart';
void main() {
final db = duckdb.open(":memory:");
final connection = db.connect();
connection.execute('''
CREATE TABLE users (id INTEGER, name VARCHAR, age INTEGER);
INSERT INTO users VALUES (1, 'Alice', 30), (2, 'Bob', 25);
''');
final result = connection.query("SELECT * FROM users WHERE age > 28").fetchAll();
for (final row in result) {
print(row);
}
connection.close();
db.close();
}
import 'package:dart_duckdb/dart_duckdb.dart';
void main() {
final db = duckdb.open(":memory:");
final connection = db.connect();
await Isolate.spawn(backgroundTask, db.transferrable);
connection.close();
db.close();
}
void backgroundTask(TransferableDatabase transferableDb) {
final connection = duckdb.connectWithTransferred(transferableDb);
// Access database ...
// fetch is needed to send the data back to the main isolate
}
We welcome contributions to DuckDB.Dart! If you have suggestions for improvements or bug fixes, please follow these steps:
If you encounter any issues or have questions, please check our issue tracker
Install fvm, Getting Started
Install any platform dependencies for DuckDB. Here are the DuckDB Building Instructions. Also, the github workflows are the best examples to learn from.
Run make from this project to build/patch duckdb.
To build for MacOS:
make macos
To build for an iOS device:
make ios_device
To build for an iOS simulator:
make ios_simulator
To build for Android:
make android
cd windows && ./getduck.ps1
To build for Linux:
make linux
make build