> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Dart quick start


[readme-version-support-link]:https://github.com/cloudinary/cloudinary_dart
This quick start lets you get an end-to-end implementation up and running using the Dart SDK in 5 minutes or less.

#### Prerequisites **To perform this quick start, you'll need:**

* A Cloudinary account. If you don't have one yet, you can quickly [register for free](https://cloudinary.com/users/register_free).
* Your product environment credentials. You can find your [credentials](product_environment_settings#api_keys) on the [API Keys](https://console.cloudinary.com/app/settings/api-keys) page of the Cloudinary Console Settings. 
  * To use your **API environment variable**, copy the provided format and replace the `<your_api_key>` and `<your_api_secret>` placeholders with the actual values found on the page. Your cloud name will already be correctly included in the format.
* A working Dart development environment with a [supported version][readme-version-support-link] of Dart.

> **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](dev_kickstart) for a hands-on, step-by-step introduction to Cloudinary features. You may also find our [Glossary](cloudinary_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](https://docs.flutter.dev/development/packages-and-plugins/using-packages).

```
dependencies:
  cloudinary_api: ^1.1.1
  cloudinary_url_gen: ^1.8.0
```

### Configure Cloudinary

> **INFO**: 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](https://console.cloudinary.com/app/settings/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

```dart
// Import the Cloudinary packages.
import 'package:cloudinary_url_gen/cloudinary.dart';
import 'package:cloudinary_url_gen/transformation/transformation.dart';
import 'package:cloudinary_api/uploader/cloudinary_uploader.dart';
import 'package:cloudinary_api/src/request/model/uploader_params.dart';
import 'package:cloudinary_url_gen/transformation/effect/effect.dart';
import 'package:cloudinary_url_gen/transformation/resize/resize.dart';

// Create a Cloudinary instance and set your cloud name.
var cloudinary=Cloudinary.fromStringUrl('cloudinary://API_KEY:API_SECRET@CLOUD_NAME');

void main() async{
  cloudinary.config.urlConfig.secure = true;
  await upload();
  transform();
}
```

More info about configuration...

The `secure=true` option will ensure the SDK generates HTTPS URLs, and is one of the available [optional configuration parameters](cloudinary_sdks#configuration_parameters).

## 2. Upload an image

Copy and paste this into `main.dart`:

main.dart (continued)

```dart
upload() async{
  var response = await cloudinary.uploader().upload('https://cloudinary-devs.github.io/cld-docs-assets/assets/images/butterfly.jpeg',
    params: UploadParams(
        publicId: 'quickstart_butterfly',
        uniqueFilename: false,
        overwrite: true));
  print("Public ID:");
  print(response?.data?.publicId);
  print("Secure URL:");
  print(response?.data?.secureUrl);
}
```

More info about upload...

* You can upload from various sources, including local files, but for this quick start we're using a remote file available at: 
[https://cloudinary-devs.github.io/cld-docs-assets/assets/images/butterfly.jpeg](https://cloudinary-devs.github.io/cld-docs-assets/assets/images/butterfly.jpeg).
* We've set the [public ID](cloudinary_glossary#public_id) in this example to `quickstart_butterfly`, `filename_override` to `true`, and `unique_filename` to `false` so that if you run this quick start more than once, you'll only have one file uploaded that overwrites the previous one. Without these parameters set, the default option of using a random public ID would be applied, and a new asset would be created each time.
* See the `upload` method of the [Upload API](image_upload_api_reference#upload).
* Learn more about [uploading assets](upload_images).

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

```dart
transform() {
  // Generate a delivery URL for the uploaded image with the desired transformation applied.
  String url = (cloudinary.image('quickstart_butterfly')
    ..transformation(Transformation()
      ..resize(Resize.fill()
        ..width(250)
        ..height(250))
      ..effect(Effect.sepia())))
       .toString();
  print("Secure URL with Transformation:");
  print(url);
}
```

More info about transformations...

There are many ways to transform your assets. Find them all in the [transformation reference](transformation_reference).

## 4. Run your code

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

![Transformed image](https://res.cloudinary.com/demo/image/upload/c_fill,h_250,w_250/e_sepia/quickstart_butterfly "with_code: false")

## View the completed code

This code is available on [GitHub](https://github.com/cloudinary-devs/dart_sdk_quick_start).

> **Ready to learn more?**:
>
> * Understand the architecture of the Dart SDK and get a more detailed [overview](dart_integration#overview) of the libraries.

> * Find out more about [transforming images and videos](dart_media_transformations) using `@cloudinary_url_gen`.

> * View a comprehensive listing of all available transformations with syntax details and examples in the [transformation reference](transformation_reference).
