Skip to content

Commit 749d0b7

Browse files
committed
♻️ Accept Path generic type in SortPathDelegate
1 parent 26addd9 commit 749d0b7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

guides/migration_guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ After:
7171
Future<void> switchPath([P? pathEntity]);
7272
```
7373

74+
### `SortPathDelegate`
75+
76+
`SortPathDelegate` accepts a generic type `Path` now, and the type will be delivered to the `sort` method.
77+
7478
## 5.0.0
7579

7680
### Summary

lib/src/delegates/sort_path_delegate.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import 'package:photo_manager/photo_manager.dart';
1010
/// Define [sort] to sort the asset path list.
1111
/// Usually integrate with [List.sort].
1212
/// 通过定义 [sort] 方法对资源路径列表进行排序。通常使用 [List.sort]
13-
abstract class SortPathDelegate {
13+
abstract class SortPathDelegate<Path> {
1414
const SortPathDelegate();
1515

16-
void sort(List<AssetPathEntity> list);
16+
void sort(List<Path> list);
1717

18-
static const SortPathDelegate common = CommonSortPathDelegate();
18+
static const SortPathDelegate<AssetPathEntity> common =
19+
CommonSortPathDelegate();
1920
}
2021

2122
/// Common sort path delegate.
@@ -24,7 +25,7 @@ abstract class SortPathDelegate {
2425
/// This delegate will bring "Recent" (All photos), "Camera", "Screenshot(?s)"
2526
/// to the front of the paths list.
2627
/// 该实现会把“最近”、“相机”、“截图”排到列表头部。
27-
class CommonSortPathDelegate extends SortPathDelegate {
28+
class CommonSortPathDelegate extends SortPathDelegate<AssetPathEntity> {
2829
const CommonSortPathDelegate();
2930

3031
@override

0 commit comments

Comments
 (0)