Implementing pull-to-refresh in Flutter with Riverpod

Issue

I am new to Riverpod and trying to implement pull to refresh with Riverpod in my Flutter app and can’t seem to find any good tutorial online. Has anyone implemented pull-to-refresh in their Flutter app while using Riverpod. I have looked for tutorials everywhere, but most I found was simple network request on app load. Thanks in advance!

using these dependencies for riverpod and network requests.
flutter_riverpod: ^0.12.1
dio: ^3.0.10

Solution

You can use context.refresh(yourProvider) in your refresh action. Works great.

In Riverpod 1.0.0 and above, you can use ref.refresh(yourProvider)

Answered By – Randal Schwartz

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published