I have some difficulties finding if an image/video exists in my Cloudinary media.
I’m using Dart (cli project) and the documentation recommended packages: cloudinary_api, cloudinary_url_gen
the following code works with the publicId but not with the image name.
static bool imageExists({String publicId = ''}) {
try {
if (!_isInitialized) {
init();
}
// TODO: figure out a way to get the image by its name instead.
final CldImage cldImage = cloudinary.image(publicId);
print(cldImage);
// cldImage.
return false;
} catch (e) {
print(e);
rethrow;
}
}
I have implemented a singleton class you can find the whole implementation here:
https://gist.github.com/callmephil/1f1fdcff2ec6ffcf5cc8bdc54027b6a4
I have a constraint where I can’t directly store the image publicId and there’s very little documentation within the lib, and the official Cloudinary Documentation for dart is quite outdated as well. this complicates the task a lot…
can you clarify what you mean when you say it works with publicId but not image name? Can you send some examples and the error you receive?