clearSelection method
Clear selected entities
Implementation
void clearSelection([List<LikkEntity>? list]) {
if (list == null) {
_onSubmitted?.call([]);
_clearedSelection = true;
_internal = true;
value = const GalleryValue();
return;
}
final _afterRemove = value.selectedEntities
..removeWhere((element) => list.contains(element));
_onSubmitted?.call(_afterRemove);
_clearedSelection = false;
_internal = true;
if (_afterRemove.isEmpty) {
value = const GalleryValue();
return;
}
value = value.copyWith(
selectedEntities: _afterRemove,
previousSelection: false,
);
}