getPaths method
Get paths. 获取所有的资源路径
Implementation
@override
Future<void> getPaths() async {
// Initial base options.
// Enable need title for audios and image to get proper display.
final FilterOptionGroup options = FilterOptionGroup(
imageOption: const FilterOption(
needTitle: true,
sizeConstraint: SizeConstraint(ignoreSize: true),
),
audioOption: const FilterOption(
needTitle: true,
sizeConstraint: SizeConstraint(ignoreSize: true),
),
containsPathModified: true,
);
// Merge user's filter option into base options if it's not null.
if (filterOptions != null) {
options.merge(filterOptions!);
}
final List<AssetPathEntity> list = await PhotoManager.getAssetPathList(
type: requestType,
filterOption: options,
);
// Sort path using sort path delegate.
Singleton.sortPathDelegate.sort(list);
for (final AssetPathEntity pathEntity in list) {
// Use sync method to avoid unnecessary wait.
_pathsList[pathEntity] = null;
getThumbnailFromPath(pathEntity);
}
// Set first path entity as current path entity.
if (_pathsList.isNotEmpty) {
_currentPath ??= pathsList.keys.elementAt(0);
}
}