Closed KP-Jaco closed 3 days ago
It's probably easier to write a Dart wrapper around the official JS SDK for turso and then use that instead of using the sqlite3.wasm
shipped with sqlite3.dart
.
package:sqlite3
has its own custom sqlite3 build that is different from what Turso is doing (they've forked the upstream sqlite3 wasm builds, which is a different setup).
The last time I've checked, the actual synchronization bits weren't in libSQL directly and instead parts of different Rust crates, I'm not sure how they end up being compiled for the web in the end. Looking at this, probably not at all.
We have an example here that shows how to do custom sqlite3 compilations with extensions written in Rust for the web. That might be useful as a starting point to port parts of the synchronization stuff over.
(if you don't need offline functionality on the web though, you can use drift_hrana
already without any external WebAssembly modules).
I am just doing some preliminary research on what it would take to create a Turso flavor of the wasm build for use in flutter WEB. Their recent announcement about offline writes is quite exciting, but I have a multiplatform app that uses drift currently running on Android, iOS and Web so I'm trying to understand where this work would need to happen. Would there need to be a custom build of libsql for wasm?