tecfy_database 1.2.2
tecfy_database: ^1.2.2 copied to clipboard
A fast, realtime, JSON-based, index-driven local database for Flutter, built on SQLite. Schemaless documents with native indexed queries and reactive streams.
1.2.2 #
Fixed #
- Stream listener leak:
stream(),count()anddoc().stream()now register their listener only while the stream has subscribers and unregister it when the last one cancels. Previously every call added a listener that was never removed, so streams created inside a widget'sbuild()piled up and each write re-ran all of their queries. - Document lock could stay held forever: the global lock around
doc().get()/update()/delete()is now a FIFO mutex that is always released, even when the query throws. Waiters no longer poll every 50 ms.
Changed #
- Re-queries triggered while a listener's query is already running are coalesced into one follow-up run, so a burst of writes costs at most two queries per stream and results can't arrive out of order.
- Query errors inside a stream are now delivered to the stream as errors instead of escaping as unhandled async errors.
get()/search()results of 500+ rows are JSON-decoded on a background isolate (not on web).TecfyDatabase.dbLockis now read-only.
1.2.0 #
Added #
- Optional
TecfyDatabase(databaseFactory:, inMemory:)parameters — open with a custom sqflite factory and/or an in-memory database. Fully backward compatible; existing constructors are unaffected. - New exports:
DatabaseFactory,databaseFactoryFfi,sqfliteFfiInit, andinMemoryDatabasePath(useful for writing your own tests). - Full unit test suite (init/isReady, CRUD, document ops, primary keys, schema migration, field types, filters, search/pagination, batch, streams, error paths) with ~90% line coverage.
- GitHub Actions CI: format check, analyze, tests with coverage, and
pub publishdry-run. - Runnable benchmark harness (
benchmark/tecfy_benchmark.dart) with indicative results published in the README. - Dartdoc comments across the public API.
- Expanded example app into a gallery: complex queries, batch, pagination, realtime streams, and error handling.
- Documentation: FAQ, Troubleshooting, Migration guide, per-platform limitations, and a Production Readiness guide (
doc/production_readiness.md). - Community files:
CONTRIBUTING.md, issue templates, and a pull-request template. .pubignoreto keep internal planning docs and build artifacts out of the published package.
Changed #
dispose()now returnsFuture<void>so callers canawaita clean close. Existingdispose();call sites remain valid.- Expanded the
pubspec.yamldescriptionand addedrepository/issue_trackermetadata.
Fixed #
- Custom primary keys: a collection declared with a custom
primaryField(non-id) now resolves correctly fordoc()lookups, updates, deletes, and read-back. Previously such collections queried/returned the literalidcolumn and inserted the key column asNULL. - No-filter aggregates:
searchCount(),searchAny(), and the no-filtercount()stream now count all rows. Previously they builtWHERE nulland always returned0/false. - Corrected the README datetime-filter example to pass an epoch integer.
Known issues #
- Indexed
datetimecolumns store microseconds internally while the document body uses milliseconds; theadd/getround trip is correct, butdatetimefilter values must be passed as epoch integers (yourDate.millisecondsSinceEpoch). See the README Troubleshooting section.
1.1.3 #
isReady()now waits until every collection's table and indexes are actually created (fixes "no such table" races on fresh installs).- Creating a second
TecfyDatabaseinstance (e.g. after logout/login) no longer hangsisReady()forever; it reuses the open database and rebuilds the collection operations. dispose()unregisters the GetIt database singleton and clears operations so a later re-init works.commitBatch()notifies listeners only after the commit completes, so listeners can't re-query before the new rows are visible.- Export
ConflictAlgorithmandBatchso callers can request upsert behavior without importing sqflite directly.
0.0.8 #
- enhance performance
0.0.1 #
- Describe initial release.