Skip to content

Implement Drift database backend as alternative to ObjectBox - #199

Open
mpeter50 wants to merge 22 commits into
JaffaKetchup:mainfrom
mpeter50:drift_2
Open

Implement Drift database backend as alternative to ObjectBox#199
mpeter50 wants to merge 22 commits into
JaffaKetchup:mainfrom
mpeter50:drift_2

Conversation

@mpeter50

Copy link
Copy Markdown

The motivation for this pull request is to add support for a free software database backend, resolving #197 and potentially other issues.
The current ObjectBox database backend is not free software, and it includes binary blobs, making it unauditable, which is critical for distributors that do not allow binary blobs in releases, like F-droid. This situation might invalidate the GPL license on this repository.
The advantages of Drift over ObjectBox is that it is free software, and is not burdened with the above issues.

This branch is very much experimental for now. It builds upon #196, making it compile and run.
A through review is needed before a possible merging, and probably quite some changes, but the current state seems to be functional when used in the EveryDoor mapping app for Android.
Things that need to be verified include correct functionality, and whether objectbox was indeed completely removed.
Currently this branch completely removes ObjectBox, but that is not necessary if Flutter's build system can be configured to produce different release flavors with different dependencies. It may also be possible to move the objectbox backend to a different package.

Any reviews and suggestions are welcome. I'll try to respond to them, but do know that I dont have any more Flutter/Dart experience than what I obtained while making these patches.

JaffaKetchup and others added 22 commits January 22, 2025 16:04
…ntation to Drift models, and update the database schema.
…hance documentation for its generated model files.
- Created drift/web/backend.dart with full FMTCBackendInternal implementation using WasmDatabase
- Uses WasmSqlite3.loadFromUrl for in-memory databases, WasmDatabase.open for persistent
- Import/export throws UnsupportedError on web (no file system access)
- Thread-safe impl shares DB instance (web has no true isolates)
- Updated export_external.dart with conditional Drift import (web vs native)
- Added sqlite3 ^2.7.5 dependency for WASM support
do not search for files in places where not needed

errors:

example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/file_picker_macos_test.dart objectbox_generator:resolver
E Could not resolve annotation for `library asset:flutter_map_tile_caching/example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/file_picker_macos_test.dart`.
example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/file_picker_utils_test.dart objectbox_generator:resolver
E Could not resolve annotation for `library asset:flutter_map_tile_caching/example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/file_picker_utils_test.dart`.
example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/file_picker_windows_test.dart objectbox_generator:resolver
E Could not resolve annotation for `library asset:flutter_map_tile_caching/example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/file_picker_windows_test.dart`.
example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/linux/dialog_handler_test.dart objectbox_generator:resolver
E Could not resolve annotation for `library asset:flutter_map_tile_caching/example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/linux/dialog_handler_test.dart`.
example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/linux/kdialog_handler_test.dart objectbox_generator:resolver
E Could not resolve annotation for `library asset:flutter_map_tile_caching/example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/linux/kdialog_handler_test.dart`.
example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/linux/qarma_and_zenity_handler_test.dart objectbox_generator:resolver
E Could not resolve annotation for `library asset:flutter_map_tile_caching/example/windows/flutter/ephemeral/.plugin_symlinks/file_picker/test/linux/qarma_and_zenity_handler_test.dart`.
caused an error in exports
what for?

some automation did that
defaults are defined in db schema, but for the inert to work, they need to be present in the query too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants