cloudinary_public

Build Status Coverage Status

This package allows you to upload media files directly to cloudinary, without exposing your apiKey or secretKey.

Getting started

Add the dependency cloudinary_public: ^0.X.X (find recent version) to your project and start using it:

import 'package:cloudinary_public/cloudinary_public.dart';

final cloudinary = CloudinaryPublic('CLOUD_NAME', 'UPLOAD_PRESET', cache: false);

Using Image Picker Plugin

var image = await ImagePicker.pickImage(source: ImageSource.camera);

CloudinaryResponse response = await cloudinary.uploadFile(
    CloudinaryFile.fromFile(image, resourceType: CloudinaryResourceType.Image),
);

print(response.secureUrl);

Using Multi Image Picker Plugin

final images = await MultiImagePicker.pickImages(maxImages: 4);

List<CloudinaryResponse> uploadedImages = await cloudinary.multiUpload(
images
    .map(
      (image) => CloudinaryFile.fromFutureByteData(
        image.getByteData(),
        identifier: image.identifier,
      ),
    )
    .toList(),
);

print(uploadedImages[0].secureUrl);

Libraries

cloudinary_public