From 93a1d376b87c5476d060705bec0bd30bc3b6ab26 Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Thu, 8 Jul 2021 02:59:09 +0800 Subject: [PATCH] Avoid potential useless comparison --- lib/widget/selectable_item_stream_list_mixin.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/widget/selectable_item_stream_list_mixin.dart b/lib/widget/selectable_item_stream_list_mixin.dart index 01929306..4f74525b 100644 --- a/lib/widget/selectable_item_stream_list_mixin.dart +++ b/lib/widget/selectable_item_stream_list_mixin.dart @@ -7,6 +7,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:logging/logging.dart'; +import 'package:nc_photos/iterable_extension.dart'; import 'package:nc_photos/k.dart' as k; import 'package:nc_photos/platform/k.dart' as platform_k; import 'package:nc_photos/session_storage.dart'; @@ -123,7 +124,7 @@ mixin SelectableItemStreamListMixin on State { void _onItemTap(SelectableItem item, int index) { if (isSelectionMode) { - if (!_items.contains(item)) { + if (!_items.containsIdentical(item)) { _log.warning("[_onItemTap] Item not found in backing list, ignoring"); return; } @@ -156,7 +157,7 @@ mixin SelectableItemStreamListMixin on State { } void _onItemLongPress(SelectableItem item, int index) { - if (!_items.contains(item)) { + if (!_items.containsIdentical(item)) { _log.warning( "[_onItemLongPress] Item not found in backing list, ignoring"); return;