rewardProviderGrouped method
Widget
rewardProviderGrouped({
- required Widget onBuild(
- DatedRewards? value
- Widget buildLoading()?,
- Widget buildError()?,
Implementation
Widget rewardProviderGrouped({
required Widget Function(DatedRewards? value) onBuild,
Widget Function()? buildLoading,
Widget Function()? buildError,
}) {
return FutureBuilder<DatedRewards?>(
future: RewardHelper.fetchRewardsGrouped(),
initialData: null,
builder: (context, snapshot) {
if (snapshot.hasError) {
if (buildError != null) {
return Center(
child: Text("Error Fetching Rewards"),
);
}
return Center(
child: Text("Error Fetching Rewards"),
);
}
if (!snapshot.hasData) {
if (buildLoading != null) return buildLoading();
return Center(
child: CircularProgressIndicator(),
);
}
return onBuild(snapshot.data);
},
);
}