cloudinary_public 0.3.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new61

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);

0.3.2 #

Update readme

0.3.0 - 0.3.1 #

Rename uploadFutureFiles() to multiUpload()

0.2.1 #

  • Support for future byte data

0.2.0 #

  • Multiple files upload support

0.1.0 #

  • Add example
  • Update readme

0.0.x #

  • Setting up the project

example/lib/example.dart

import 'dart:io';

import 'package:cloudinary_public/cloudinary_public.dart';
import 'package:flutter/services.dart';

main() async {
  // set cache as true if you don't want to make an upload call with files of the same filename
  // in such case if the filepath/identifier has already been uploaded before, you simply get the previously cached response.
  var cloudinary =
      CloudinaryPublic('CLOUD_NAME', 'UPLOAD_PRESET', cache: false);

  // Using a file. For example, gotten from: https://pub.dev/packages/image_picker
  File file = File('');
  CloudinaryResponse response = await cloudinary.uploadFile(
    CloudinaryFile.fromFile(file, resourceType: CloudinaryResourceType.Image),
  );

  print(response.secureUrl);

  // Using Byte Data. For example gotten from: https://pub.dev/packages/multi_image_picker
  //  final images = await MultiImagePicker.pickImages(maxImages: 4);
  final images = List.generate(4, (_) => Asset());

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

  print(uploadedImages[0].secureUrl);
}

class Asset {
  String identifier = 'image.jpg';

  Future<ByteData> getByteData() async => ByteData(10);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  cloudinary_public: ^0.3.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:cloudinary_public/cloudinary_public.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
23
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on May 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
dio ^3.0.9 3.0.9
flutter 0.0.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.7.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
matcher ^0.12.6
mockito ^4.1.1