SkillDevs / electric_dart

A Dart implementation for Electric (electric-sql.com).
Apache License 2.0
104 stars 9 forks source link

Offine First, Sync Optional #6

Closed jtkeyva closed 8 months ago

jtkeyva commented 11 months ago

Can this be used as a simple Offline First solution without syncing? Syncing requires another host (I am using Supabase) is that correct? What if all I care about is offline capability? What if there is no need to sync? Just simply be able to work offline and have it push to Supabase when back online?

Thanks for the hard work, this is great stuff

davidmartos96 commented 11 months ago

@jtkeyva I don't think that is currently possible, as the Electric service is the one that understands the changes that have been made and applies them to the Postgres.

Here is a similar feature request, although I don't think it's the same: https://github.com/electric-sql/electric/issues/491

You can also ask it in the Discord server. This repo is essentially a port of the functionality in the official client, it doesn't have extra features other than the drift package to interact with the database

jtkeyva commented 11 months ago

@davidmartos96 thank you. sounds a bit like a business decision to get some vendor lock-in. maybe not. can't the service just be optionally run on the client?

i'll try discord and see what they say

davidmartos96 commented 8 months ago

@jtkeyva Coming back to this, in the latest version v0.5.2, based on Electric v0.9.3 and v0.9.4, you can electrify the database without connecting to the Electric service.

final electric = await electrify(...);

// The following would be optional if you want the app to stay connected with the service and sync
if (beOnline) {
  final String token = '<your JWT>';
  await electric.connect(token);
}
jtkeyva commented 8 months ago

thank you i will give iit a try soon