Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing pull-to-refresh in Flutter with Riverpod

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

like image 420
camboo_babbage Avatar asked Dec 06 '20 08:12

camboo_babbage


1 Answers

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)

like image 176
Randal Schwartz Avatar answered Sep 19 '22 09:09

Randal Schwartz