Skip to content
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

Ability to save requests offline and reexecute them later. #862

Closed
wants to merge 1 commit into from

Conversation

ConProgramming
Copy link

This is very useful for supporting offline mode in apps. Not sure if should be implemented like this, but this works for my use case.

@dshukertjr
Copy link
Member

If you want to execute the request in a later time, you can just not call await on the method. Then you can just call await when you actually want to execute it.

final request = supabase.from('table').select();

... some time later
final data = await request;

@dshukertjr dshukertjr closed this Mar 17, 2024
@ConProgramming
Copy link
Author

I need to serialize the request to Json to save offline. Saving it to a HiveBloc

@dshukertjr
Copy link
Member

@ConProgramming
Cool. You can create your own extension method to implement this for your particular use case if you are not doing it already. Unfortunately, we will not add support for these methods on this SDK.

@ConProgramming
Copy link
Author

What's the recommended way to do that? I thought I would have to patch SDK

@dshukertjr
Copy link
Member

You can read about extension methods here:
https://dart.dev/language/extension-methods

@ConProgramming
Copy link
Author

Thanks

@ConProgramming
Copy link
Author

It seems extension methods won't work, because I cannot override private methods.

Is this possible without updating the sdk?

@dshukertjr
Copy link
Member

Right, I missed that.

Is this possible without updating the SDK?

I suppose not. You can fork the repo, add the feature, and add the package to your Flutter app.
https://stackoverflow.com/questions/54022704/how-to-add-a-package-from-github-in-flutter

@ConProgramming ConProgramming deleted the patch-1 branch March 27, 2024 13:49
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