database_adapter_sqlite 0.1.0 database_adapter_sqlite: ^0.1.0 copied to clipboard
An adapter for using 'package:database' API with SQLite.
Overview #
Provides an adapter for using the package database with SQLite. The implementation uses the package sqflite.
Getting started #
1.Add dependency #
dependencies:
database: any
database_adapter_sqlite: any
2.Configure #
import 'package:database/database.dart';
import 'package:database/sql.dart';
import 'package:database_adapter_sqlite/database_adapter_sqlite.dart';
Future main() async {
final config = SQLite(
path: 'path/to/database.db',
);
final sqlClient = config.database().sqlClient;
final result = await database.querySql('SELECT name FROM employee').toRows();
for (var row in result.rows) {
print('Name: ${row[0]}');
}
}