addItems method
Implementation
Future<bool> addItems(List<dynamic> newItems, {bool reassemble = false, bool append = true}) async{
if(isNullOrEmpty(newItems)) return false;
if(reassemble == true || widget.skipAnimation == true || itemAnimation == NUIListItemAnimation.NONE){
if(append != false) {
items.addAll(newItems);
}
else{
final cloneList = <dynamic>[];
cloneList.addAll(items);
items.clear();
items.addAll(newItems);
items.addAll(cloneList);
}
listKey.currentState?.setState(() {
});
sliverListKey.currentState?.setState(() {
});
}
else{
if(append != false) {
for (dynamic item in newItems) {
if(curModel?.paginationLoading == true || curModel?.skeletalLoading == true) break;
await Future.delayed(animateDuration);
addItem(item);
}
}
else{
int position = fixedFirstItem != null ? 1 : 0;
for(dynamic item in newItems){
if(curModel?.paginationLoading == true || curModel?.skeletalLoading == true) break;
await Future.delayed(animateDuration);
addItemAt(item, position);
position++;
}
}
}
return true;
}