database 0.3.2 database: ^0.3.2 copied to clipboard
A database access API that's vendor-agnostic. Adapters exist for browser APIs, SQLite, Google Cloud Firestore, PostgreSQL, ElasticSearch, Algolia, and others.
import 'package:database/database.dart';
void main() async {
// Choose a database
final database = MemoryDatabaseAdapter().database();
// Search
final response = await database.collection('people').search(
query: Query.parse(
'"software developer" (dart OR javascript)',
take: 10,
),
);
// Print results
for (var snapshot in response.snapshots) {
print('Employee ID: ${snapshot.document.documentId}');
print('Employee name: ${snapshot.data['name']}');
print('');
}
}