Last updated: Jun-04-2024
Overview
Cloudinary's Dart SDK provides simple, yet comprehensive image and video transformation, optimization, and delivery capabilities that you can implement using code that integrates seamlessly with your existing Dart application.
The Dart SDK allows you to transform and deliver assets that are already in your Cloudinary repository. See Dart image and video upload to upload using the upload
method of Cloudinary's Upload API.
Key features
- Uses Cloudinary's new SDK action based syntax with enhanced code autocomplete.
- Build dynamic URLs for delivering images and videos.
- Actions and transformations are immutable, for easier and safer code reuse.
Get started
Install and configure the SDK in your project to get started.
Add the Dart SDK dependency
To use this SDK, add Cloudinary as a dependency in your pubspec.yaml file.
Add your Cloudinary configuration
The Cloudinary
class is the main entry point for using the library. Your cloud_name
is required to create an instance of this class. Your api_key
and api_secret
are also needed to perform secure API calls to Cloudinary (e.g., image and video uploads). Setting the configuration parameters can be done either programmatically using an appropriate constructor of the Cloudinary class or globally using an environment variable. You can find your configuration credentials in the API Keys page of the Cloudinary Console Settings.
To set configuration parameters in your Dart application, use Cloudinary.fromStringUrl
and pass your API environment variable:
Define optional configuration parameters by adding them to your configuration file. For example, set the secure
optional configuration parameter to true
in the configuration file named cloudinary
:
Examples
Here's a simple example for generating a Cloudinary image URL, including a resize transformation, using the Dart SDK:
Here's a simple example for generating a Cloudinary video URL, including a resize transformation with boomerang and vignette effects, using the Dart SDK:
..addTransformation()
method of the Dart SDK.For more information about the Dart SDK syntax, see Syntax overview.
- See all possible transformations in the Transformation URL API reference.
- See all Dart transformation actions and qualifiers in the Dart reference.
- See examples of powerful image and video transformations using Dart code
and see our image transformations and video transformations docs. - Stay tuned for updates with the Programmable Media Release Notes and the Cloudinary Blog.
- Take a look at our iOS and Android SDKs as alternatives for mobile development with Cloudinary.