onOnSelectAsset method

Future<void> onOnSelectAsset(
  1. AssetEntity asset
)

Select asset

Implementation

Future<void> onOnSelectAsset(AssetEntity asset) async {
  final bool isContain = dataStore.selectedAssets.value.containsAsset(asset);
  if (isContain) {
    dataStore.selectedAssets.removeAsset(await AssetModel.fromAssetEntity(asset));
  } else {
    if (dataStore.limitToSelection != -1 &&
        dataStore.selectedAssets.value.length >= dataStore.limitToSelection) {
      return;
    }
    dataStore.selectedAssets.addAsset(await AssetModel.fromAssetEntity(asset));
  }
}