Skip to content

Commit 8010567

Browse files
committed
Remove redundant isNotEmpty checking.
1 parent a764a6e commit 8010567

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

example/lib/customs/pickers/directory_file_asset_picker.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,7 @@ class FileAssetPickerBuilder
703703
) {
704704
int currentIndex = index;
705705

706-
if (prependSpecialItems.isNotEmpty) {
707-
currentIndex = index - prependSpecialItems.length;
708-
}
706+
currentIndex = index - prependSpecialItems.length;
709707

710708
final File asset = currentAssets.elementAt(currentIndex);
711709
final Widget builder = imageAndVideoItemBuilder(

lib/src/delegates/asset_picker_builder_delegate.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,9 +1440,7 @@ class DefaultAssetPickerBuilderDelegate
14401440

14411441
int currentIndex = index;
14421442

1443-
if (prepandSpecialItemModels.isNotEmpty) {
1444-
currentIndex = index - prepandSpecialItemModels.length;
1445-
}
1443+
currentIndex = index - prepandSpecialItemModels.length;
14461444

14471445
if (currentPathEntity == null) {
14481446
return const SizedBox.shrink();
@@ -1573,9 +1571,8 @@ class DefaultAssetPickerBuilderDelegate
15731571
}) {
15741572
int index = assets.indexWhere((AssetEntity e) => e.id == id);
15751573

1576-
if (prependSpecialItems.isNotEmpty) {
1577-
index += prependSpecialItems.length;
1578-
}
1574+
index += prependSpecialItems.length;
1575+
15791576
index += placeholderCount;
15801577
return index;
15811578
}

0 commit comments

Comments
 (0)