Skip to content

Add beforeOpen callback to native factories - #152

Merged
simolus3 merged 1 commit into
mainfrom
async-setup
Jul 11, 2026
Merged

Add beforeOpen callback to native factories#152
simolus3 merged 1 commit into
mainfrom
async-setup

Conversation

@simolus3

@simolus3 simolus3 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Sometimes, it's convenient to run an async setup step. For example, the /tmp directory is inaccessible on older Android versions and one might want to use path_provider to configure sqlite3_temp_directory to point to an app-specific temporary directory.

Of course, one could simply do that before using databases:

void main() {
  sqlite3.tempDirectory = await findTemporaryDirectory();
  final db = PowerSyncDatabase(...);
}

But then you need an async suspension before your app can even reference a database, which is annoying. Since databases are opened asynchronously internally, this adds an async callback for that instead.

cc @davidmartos96

@simolus3
simolus3 merged commit f13af7c into main Jul 11, 2026
6 checks passed
@simolus3
simolus3 deleted the async-setup branch July 11, 2026 09:40
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.

2 participants