SQLite adapters
FDC Pro provides two SQLite adapter models:
FdcSqliteTableAdapterfor writable table-backed CRUD datasets;FdcSqliteQueryAdapterfor read-only SQL result sets.
Table adapter
Use the table adapter when dataset fields map directly to SQLite columns.
final customers = FdcDataSet(
fields: const [
FdcIntegerField(name: 'customer_id', isKey: true),
FdcStringField(name: 'company', size: 120),
FdcStringField(name: 'city', size: 80),
FdcStringField(name: 'state', size: 2),
],
adapter: FdcSqliteTableAdapter(
databasePath: databasePath,
table: 'customers',
sorts: const [
FdcDataAdapterSort(
fieldName: 'company',
sortType: FdcSortType.ascending,
),
],
),
);
await customers.open();
Field names must match SQLite column names exactly. When the dataset does not provide explicit fields, the table adapter can infer schema information from PRAGMA table_info during open.
The path-backed constructor performs SQLite work through the adapter's worker-backed execution path.
Query adapter
Use the query adapter for read-only SQL results:
final sales = FdcDataSet(
fields: const [
FdcStringField(name: 'state', size: 2),
FdcDecimalField(name: 'total_sales', precision: 18, scale: 2),
],
adapter: FdcSqliteQueryAdapter(
databasePath: databasePath,
sql: '''
SELECT state, SUM(amount) AS total_sales
FROM orders
GROUP BY state
''',
),
);
The default query adapter runs the supplied SQL as a raw read-only source. It does not claim adapter-side filtering, sorting, or paging for arbitrary SQL.
Wrappable queries
For a simple SELECT that can safely be wrapped as a subquery, use FdcSqliteQueryAdapter.wrappable:
final adapter = FdcSqliteQueryAdapter.wrappable(
databasePath: databasePath,
sql: '''
SELECT
order_id,
customer_id,
order_date,
amount
FROM orders
''',
);
Wrappable mode can apply outer filtering, search, sorting, paging, and aggregates. Every projected column, including expressions, must expose a stable alias matching the FDC field name exactly.
Resource lifecycle
Datasets dispose their adapters when the dataset is disposed. When application code owns an adapter directly and needs explicit completion of SQLite shutdown, the table adapter also exposes an asynchronous close() operation.