updateState method
void
updateState({
- required String who,
- LinkedHashSet<
K> ? selectedKeys, - LinkedHashSet<
K> ? expandedKeys, - List<
TListItem< ? displayItems,T, K> > - int? page,
- int? itemsPerPage,
- int? totalItems,
- bool? loading,
- bool? hasMoreItems,
- String? search,
- TSelectionMode? selectionMode,
- TExpansionMode? expansionMode,
- TListError? error,
Implementation
void updateState({
required String who,
LinkedHashSet<K>? selectedKeys,
LinkedHashSet<K>? expandedKeys,
List<TListItem<T, K>>? displayItems,
int? page,
int? itemsPerPage,
int? totalItems,
bool? loading,
bool? hasMoreItems,
String? search,
TSelectionMode? selectionMode,
TExpansionMode? expansionMode,
TListError? error,
}) {
var effectiveSelectedKeys = selectedKeys ?? value.selectedKeys;
var effectiveExpandedKeys = expandedKeys ?? value.expandedKeys;
var effectiveDisplayItems = displayItems ?? value.displayItems;
if ((selectable || expandable) && (displayItems != null || selectedKeys != null || expandedKeys != null)) {
effectiveDisplayItems = _preserveStateOptimized(
items: effectiveDisplayItems,
selectedKeys: effectiveSelectedKeys,
expandedKeys: effectiveExpandedKeys,
);
}
value = TListState<T, K>(
displayItems: effectiveDisplayItems,
selectedKeys: effectiveSelectedKeys,
expandedKeys: effectiveExpandedKeys,
page: page ?? value.page,
itemsPerPage: itemsPerPage ?? value.itemsPerPage,
totalItems: totalItems ?? value.totalItems,
loading: loading ?? value.loading,
hasMoreItems: hasMoreItems ?? value.hasMoreItems,
search: search ?? value.search,
selectionMode: selectionMode ?? value.selectionMode,
expansionMode: expansionMode ?? value.expansionMode,
error: error ?? value.error,
);
debugPrint("$who: $value");
}