-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Supabase Extension for Loon #23
Comments
Hey! Yea I havent used Supabase before. It looks cool. I'll need to look into writing an adapter but it should definitely be possible. Probably not too hard. Does it currently persist data for you? Is there something about using Loon with it that would make things easier for you or you're interested in? Have a good one |
The reason why Loon would be interesting is because the supabase package currently does not persist data for you. |
Oh cool yea I see now that they recommend SharedPreferences currently as the solution: https://pub.dev/packages/supabase_flutter#a-idcustom-localstorageacustom-localstorage Yea looks like that could go to Loon instead. I'm going to play around with Supabase a bit. |
So i looked through the Supabase package last night. It's cool, it definitely doesn't try to persist the Postgres data. I think it would be more challenging to write than the Firestore extension for a couple reasons:
That said, it does support realtime streaming and table watching: If you're comfortable streaming changes to your table then what you could do is like in the image, subscribe to all changes and then dump that into a local persistent cache like Loon. An example might look like this: client
.channel('public:todos')
.onPostgresChanges(
event: PostgresChangeEvent.all,
schema: 'public',
table: 'todos',
callback: (payload) {
print(payload);
// {
// 'schema': 'public',
// 'table': 'todos',
// 'commit_timestamp': '2021-08-01T08:00:30Z',
// 'eventType': 'UPDATE',
// 'new': {'id': 2, 'task': 'task 2 updated', 'status': false},
// 'old': {'id': 2},
// 'errors': null
// }
final newData = payload['new'];
final docId = newData['id'];
Loon.collection('todos').doc(docId).update(newData);
}); That gets you part of the way there by at least letting you persist your data and then access it reactively through Loon across your application. Given how simple that is, I don't think it needs a full extension right now, maybe just a doc suggesting that if you want to persist to Supabase data to Loon then this approach could be an option to consider. It relies on using the streaming capabilities in Supabase though. Let me know what you think and if you know other Flutter devs using Supabase it'd be cool to hear if they can think of a better solution. |
Have you seen the discussions about Supabase building offline sync into their own packages? |
thanks @danReynolds for the detailed write up. I will try the approach with streaming db changes into loon. |
Thank you for developing Loon. Looks great. Is it possible to use it with supabase?
The text was updated successfully, but these errors were encountered: