May NyPullToRefresh could be better #121
-
My Data{ Your widget error that i occured[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value and here is code your where the error occured_onLoading() async {
_iteration++;
List<T>? newData = await widget.data(_iteration);
if (newData == null) _refreshController.loadNoData();
if (newData!.isEmpty) {
_refreshController.loadNoData();
return;
}
_data.addAll(newData);
if (mounted) {
setState(() {});
}
_refreshController.loadComplete();
} May be you could check for runtime type thencheck for nullable to is empty or length here is and i get while using ny_pull_to_refresh |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @jitendravn, Can you share your complete code? Thanks |
Beta Was this translation helpful? Give feedback.
-
I have received these data from the server
and I'm using your PullToRefresh Widget please see your ny_pull_to_refresh.dart _onLoading() async {
_iteration++;
List<T>? newData = await widget.data(_iteration);
if (newData == null) _refreshController.loadNoData();
if (newData!.isEmpty) {
_refreshController.loadNoData();
return;
}
_data.addAll(newData);
if (mounted) {
setState(() {});
}
_refreshController.loadComplete();
}
|
Beta Was this translation helpful? Give feedback.
Hi @jitendravn,
The
NyPullToRefresh
widget expects a return type ofList
in thedata
parameter.You should modify your code to this.
Hope that helps.