Pull Down To Refresh The Screen In Flutter

pull_to_refresh: ^1.6.3
flutter pub get
import 'package:pull_to_refresh/pull_to_refresh.dart';
RefreshController _refreshController =
RefreshController(initialRefresh: false);
return Scaffold(
body: SmartRefresher(
enablePullDown: true,
controller: _refreshController,
onRefresh: _onRefresh,
onLoading: _onLoading,
child: ListView.builder(
itemBuilder: (c, i) =>Card(Center(child:Text(items[i]))),
itemCount: items.length,
),
),
);
void _onLoading() async {
// your api here
_refreshController.loadComplete();
}
void _onRefresh() async {
// your api here
_refreshController.refreshCompleted();
}

--

--

--

Flutter || Android Developer Since 2018

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Get Rid of the Boilerplate in JAVA with Annotations @Lombok

InstallLombokPlugin

asp.net — postgresql — google maps connection

maps marker chart ile ilgili görsel sonucu

Hey there Creator Platform is here to service you better as Baas platform.

The battle of mindsets — Instrumental vs The Epistemic

RADIX AND DEFI

February 2022 Monthly Recap

Chainode Tech Journey with The Graph Network & GRT staking FAQ

Generic Network Layer in iOS Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akshay Papneja

Akshay Papneja

Flutter || Android Developer Since 2018

More from Medium

How to make a complex category picker animation on Flutter

Provider state management in some easy steps :

“Official Plugin” Integrating PayTm in your Flutter App: An Ultimate Guide [2022].

Flutter Project Build Warning: Mapping new ns Warning Solution