pickPath method

void pickPath(
  1. PickedAssetModel path
)

Implementation

void pickPath(PickedAssetModel path) {
  if (singlePickMode) {
    if (pickedFile.where((element) => element.id == path.id).isNotEmpty) {
      pickedFile.removeWhere((val) => val.id == path.id);
    } else {
      pickedFile.clear();
      pickedFile.add(path);
    }
  } else {
    if (pickedFile.where((element) => element.id == path.id).isNotEmpty) {
      pickedFile.removeWhere((val) => val.id == path.id);
    } else {
      if (pickedFile.length == max) {
        onPickMax.notifyListeners();
        return;
      }
      pickedFile.add(path);
    }
  }
  pickedFileNotifier.value = pickedFile;
  pickedFileNotifier.notifyListeners();
  notifyListeners();
}