Image & Video APIs

Dart quick start

Last updated: Jul-08-2025

This quick start lets you get an end-to-end implementation up and running using the Dart SDK in 5 minutes or less.

Notes
  • This quick start is designed for quick onboarding. It doesn't necessarily employ coding best practices and the code you create here isn't intended for production.
  • If you aren't familiar with Cloudinary, you may want to first take a look at the Developer Kickstart for a hands-on, step-by-step introduction to Cloudinary features.

    You may also find our Glossary helpful to understand Cloudinary-specific terminology.

1. Set up and configure the SDK

Install the package

Install the @cloudinary_url_gen package by adding Cloudinary as a dependency in your pubspec.yaml file.

Configure Cloudinary

Important
When writing your own applications, follow your organization's policy on storing secrets and don't expose your API secret.

In your main.dart file, configure your credentials using your API environment variable. Copy the API environment variable format from the API Keys page of the Cloudinary Console Settings. Replace <your_api_key> and <your_api_secret> with your actual values. Your cloud name is already correctly included in the format.

main.dart

2. Upload an image

Copy and paste this into main.dart:

main.dart (continued)

3. Transform the image

Generate a delivery URL for the uploaded image with the desired transformation applied.

Copy and paste the following code, under the configuration code:

main.dart (continued)

4. Run your code

Run the code with dart run main.dart to see the transformed image.

Transformed image

View the completed code

This code is available on GitHub.

Ready to learn more?