getAssetsPath method

Future<void> getAssetsPath({
  1. required PickerAssetType allowedTypes,
})

Get assets path

Implementation

Future<void> getAssetsPath({
  required PickerAssetType allowedTypes,
}) async {
  dataStore.availablePath.value = await PhotoManager.getAssetPathList(
    type: allowedTypes.toRequestType,
    filterOption: _filterOptionGroup,
  );

  if (dataStore.availablePath.value.isNotEmpty) {
    final List<AssetEntity> entities =
        await dataStore.availablePath.value.first.getAssetListPaged(
      page: 0,
      size: dataStore.sizePerPage,
    );
    dataStore.pathData[dataStore.availablePath.value.first.id] =
        ValueNotifier<List<AssetEntity>>(<AssetEntity>[]);

    dataStore.pathData[dataStore.availablePath.value.first.id]!.value = entities;
    dataStore.totalEntitiesCount[dataStore.availablePath.value.first.id] =
        await dataStore.availablePath.value.first.assetCountAsync;
    dataStore.pages[dataStore.availablePath.value.first.id] = 0;
    dataStore.hasMoreToLoad[dataStore.availablePath.value.first.id] =
        entities.length < dataStore.totalEntitiesCount[dataStore.availablePath.value.first.id]!;
    if (dataStore.availablePath.value.first == dataStore.availablePath.value.first) {
      dataStore.selectedPath.value = dataStore.availablePath.value.first;
    }
  }
}