clearSelection method
Implementation
void clearSelection([List<MediaEntity>? list]) {
if (list == null) {
_onSubmitted?.call([]);
internal = true;
value = const GalleryValue();
return;
}
final afterRemove = value.selectedEntities
..removeWhere((element) => list.contains(element));
_onSubmitted?.call(afterRemove);
internal = true;
if (afterRemove.isEmpty) {
value = const GalleryValue();
return;
}
value = value.copyWith(
selectedEntities: afterRemove,
previousSelection: false,
);
}