getAssetPathList method
Future<List<AssetPathEntity> >
getAssetPathList({
- bool hasAll = true,
- bool onlyAll = false,
- RequestType type = RequestType.common,
- PMFilter? filterOption,
- required PMPathFilter pathFilterOption,
Implementation
Future<List<AssetPathEntity>> getAssetPathList({
bool hasAll = true,
bool onlyAll = false,
RequestType type = RequestType.common,
PMFilter? filterOption,
required PMPathFilter pathFilterOption,
}) async {
if (onlyAll) {
assert(hasAll, 'If only is true, then the hasAll must be not null.');
}
filterOption ??= FilterOptionGroup();
// Avoid filtering live photos when searching for audios.
if (type == RequestType.audio) {
if (filterOption is FilterOptionGroup) {
filterOption.containsLivePhotos = false;
filterOption.onlyLivePhotos = false;
}
}
if (filterOption is FilterOptionGroup) {
assert(
type == RequestType.image || !filterOption.onlyLivePhotos,
'Filtering only Live Photos is only supported '
'when the request type contains image.',
);
}
final Map<dynamic, dynamic>? result = await _channel.invokeMethod(
PMConstants.mGetAssetPathList,
<String, dynamic>{
'type': type.value,
'hasAll': hasAll,
'onlyAll': onlyAll,
'option': filterOption.toMap(),
"pathOption": pathFilterOption.toMap(),
},
);
if (result == null) {
return <AssetPathEntity>[];
}
return ConvertUtils.convertToPathList(
result.cast<String, dynamic>(),
type: type,
filterOption: filterOption,
);
}