---
title: "Contentstack Delivery Dart SDK"
description: "Documentation for Dart Delivery SDK"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/dart/reference"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2025-09-15"
---

# Contentstack Delivery Dart SDK

## Contentstack - Dart Delivery SDK

## Dart Delivery SDK for Contentstack

Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application front end, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/docs/developers/java/).

Contentstack provides Dart Delivery SDK to build applications on top of Dart. Given below is the detailed guide and helpful resources to get started with our Dart Delivery SDK.

## Prerequisite

This guide will help you get started with Contentstack Dart SDK to build Flutter apps powered by Contentstack.

*   [Contentstack account](https://app.contentstack.com/#!/login)
*   [Dart](https://dart.dev/get-dart)

## SDK Installation and Setup

To use the Contentstack Dart SDK with your existing project, perform the following steps:

**Create a New Flutter Project in VS Code**

1.  Open VS Code and select **Extensions** from the left navigation panel. 
2.  Then, in the **Search Extensions in Marketplace** search box, type **Flutter**. From the quick results, click on **Flutter**.
3.  From the **Flutter** details page, click on **Install**. 
4.  Press Ctrl + Shift + P on Windows and Cmd + Shift + P on macOS.
5.  Type **flutter** and select **Flutter: New Project**.
6.  If the Flutter SDK is not installed on your machine, it will ask you to **Download SDK**. Click on it and from the pop-up that opens, click on **Open**.
7.  It will take you the **Flutter install** page. Select as per your OS and the download will begin.
8.  Once it is installed, follow steps 4 and 5 and create a new Flutter project.

**Create a New Project in Android Studio**

1.  Open Android Studio and click on **Configure**. 
2.  Then, select **Plugins**. From the resulting screen, click on **Flutter** and click on **Install**.
3.  Click on **Accept** and then **Yes** to install the Dart plugin.
4.  Click on **Restart** when prompted.
5.  In the Android Studio IDE, click on **Start a new Flutter project** from the **Welcome** screen.
6.  Then, select **Flutter Application** in the menu, and click on **Next**.
7.  On the next screen, give your project a name, provide the Flutter SDK path (where you installed the Flutter SDK), and your project location.
8.  If you prefer publishing the app, set the company domain and click on **Finish**.

**Add Dart Dependencies to Your Project**

To use Contentstack's Dart SDK in your existing project, you need to add the following code within your **pubspec.yaml** file:

dependencies:  
  contentstack: any

You can download the latest dependency version [here](https://pub.dev/packages/contentstack).

## Quickstart in 5 mins

## Initializing your SDK

Contentstack offers six [regions](/docs/developers/contentstack-regions/about-regions) North America (NA), Europe (EU), Azure North America (AZURE\_NA), Azure Europe (AZURE\_EU), GCP North America (GCP\_NA), and GCP Europe (GCP\_EU) as data centers to store customers' account details and data. These regions are independent of each other and therefore have a dedicated set of instructions to use SDKs offered by Contentstack.

To use SDKs for the Europe, Azure NA, Azure EU region, GCP NA, or GCP EU you will have to make certain changes in the configuration of the SDK, as detailed below, and the rest of the instructions remain the same.

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

dependencies:  
   contentstack: ^any

To initialize the SDK, enter the stack’s API key, delivery token, and environment name where you will publish the content, as shown in the snippet below:

import 'package:contentstack/contentstack.dart' as contentstack;  
final stack = contentstack.Stack(apiKey, deliveryToken, environment, region: contentstack.Region.<add\_your\_region>);

**Note**: By default, the SDK uses the North American region. Configuration changes are not required for North American region users.

**Refer the below code if you want to use the Europe, Azure North America, Azure Europe, GCP North America region, or GCP Europe.**

import 'package:contentstack/contentstack.dart' as contentstack;  
final stack = contentstack.Stack(apiKey, deliveryToken, environment, region: contentstack.Region.<add\_your\_region>);

Once you have initialized the SDK, you can query entries to fetch the required content.

For Setting the branch for Europe, Azure North America, Azure Europe, GCP North America, or GCP Europe refer the code below:  
  
**For Setting Branch**

import 'package:contentstack/contentstack.dart' as contentstack;  
final stack = contentstack.Stack('apiKey', 'deliveryToken', 'environment', branch: 'branch');

## Basic Queries

Contentstack SDKs let you interact with the [Content Delivery APIs](https://www.contentstack.com/docs/developers/apis/content-delivery-api) and retrieve content from Contentstack. They are read-only in nature. The SDKs fetch and deliver content from the nearest server via Fastly, our powerful and robust CDN.

**Get a Single Entry**

To retrieve a single [entry](https://www.contentstack.com/docs/content-managers/author-content/about-entries) from a [content type](https://www.contentstack.com/docs/developers/create-content-types/about-content-types), use the code snippet given below:

import contentstack  
  
stack = contentstack.Stack(api\_key='api\_key', delivery\_token='delivery\_token', environment='environment')  
contentType = stack.content\_type("content\_type\_uid")  
entry = content\_type.entry("entry\_uid")  
response = entry.fetch()

**Get Multiple Entries**

To retrieve multiple entries of a particular content type, use the code snippet given below:

import contentstack  
  
stack = contentstack.Stack(api\_key='api\_key', delivery\_token='delivery\_token', environment='environment')  
query = stack.content\_type("content\_type\_uid").query()  
response = query.find()

## Pagination

In a single instance, the [Get Multiple Entries](https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/dart/get-started-with-dart-sdk/#get-multiple-entries) query will **retrieve only the first 100 items** of the specified content type. You can paginate and retrieve the rest of the items in batches using the **skip** and **limit** parameters in subsequent requests. 

final stack = contentstack.Stack( "apiKey", "deliveryToken", "environment");   
final query = stack.contentType("contentTypeUid").entry().query().skip(20).limit(20);  
await query.find().then((response){  
   print(response);  
}).catchError((onError){  
   print(onError.message);  
});

## Stack

Stack an instance of ContentType, asset, assetQuery, and sync

## syncToken

In this API request, you need to provide the sync\_token that you received in the last complete sync process. If there are more than 100 records, you will get a pagination\_token instead

sync token fetches only the content that was added after your last sync

## sync

The Sync API takes care of syncing your Contentstack data with your app and ensures that the data is always up-to-date by providing delta updates.

content type UID. e.g., products This retrieves published entries of specified content type.

Enter the start date. e.g., **2018-08-14T00:00:00.000Z** This retrieves published entries starting from a specific date

Enter locale code. e.g., **en-us** This retrieves published entries of the specific locale

Applicable values are:

*   entry\_published
*   asset\_published
*   entry\_unpublished
*   asset\_unpublished
*   entry\_deleted
*   asset\_deleted
*   content\_type\_deleted

If you do not specify any value, it will bring all published entries and published assets.

## setHost

Adds host for the request

The host for the API url

## setHeader

adds header using header key and value

The header key

the header value

## removeHeader

Remove header using headerKey

The header key

## paginationToken

If the result of the initial sync (or subsequent sync) contains more than 100 records, the response would be paginated. It provides pagination token in the response. However, you do not have to use the pagination token manually to get the next batch, the SDK does that automatically until the sync is complete. Pagination token can be used in case you want to fetch only selected batches. It is especially useful if the sync process is interrupted midway (due to network issues, etc.). In such cases, this token can be used to restart the sync process from where it was interrupted.

The pagination token

## imageTransform

The Image Delivery API is used to retrieve, manipulate and/or convert image files of your Contentstack account and deliver it to your web or mobile properties.

Base Image Url of the image you want to manipulate

## getContentTypes

ContentType accepts contentTypeId in as the parameter

ContentType accepts query params as parameter

## contentType

ContentType accepts contentTypeId in as the parameter

ContentType accepts contentTypeId as the parameter

## assetQuery

It also returns the content of each asset in JSON format.

Asset uid

## asset

This call fetches the latest version of a specific. asset of a particular stack.

Asset uid

## getLivePreview

Live preview of the stack

## host

host of the stack

## environment

environment of the stack

## endpoint

endpoint for the api

## deliveryToken

delivery token for the stack

## stack

an instance of the stack

apiKey of the stack

Delivery Token for the stack

Environment of the stack

apiVersion is version of the API

DB region for your stack. You can choose from six regions namely, NA, EU, Azure NA, Azure EU, GCP NA, and GCP EU.

host of the api

live preview for the stack

Client to make API request

## apiKey

apiKey of for the stack

## Asset

The asset provides asset methods

## version

Specify the version number of the asset that you wish to retrieve. If the version is not specified, the details of the latest version will be retrieved..

## includeFallback

Retrieve the published content of the fallback locale if an entry is not localized in specified locale.

## includeDimension

include the dimensions (height and width) of the image in the response. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, and PSD.

## environment

To fetch the content based on specific environment

The environment

## AssetQuery

The AssetQuery provides query on assets

## includeBranch

Included branch in the response.

## version

Specify the version number of the asset that you wish to retrieve.

## relativeUrls

includes the relative URLs of the assets in the response

## includeFallback

Retrieve the published content of the fallback locale if an entry is not localized in specified locale.

## includeDimension

include the dimensions (height and width) of the image in the response.

## includeCount

To retrieve the count of entries.

## environment

Enter the name of the \[environment\] if you wish to retrieve the assets published in a particular environment.

The Environment

## ImageTransformation

ImageTransformation provides Query on image URL

## brightness

The brightness parameter allows you to increase or decrease the intensity with which an image reflects or radiates perceived ligh.

you can also define brightness using any decimal number

## blur

The blur parameter allows you to decrease the focus and clarity of a given image. To specify the extent to which you need to increase the blurriness of an image, use any decimal number (float) between 1 and 1000.

It can accept hexadecimal, combination of (Red, Blue, Green) and (Red, Blue, Green, Alpha)

## bgColor

he bg-color function lets you set a backgroud color for the given image. This is useful when applying padding or for replacing the transparent pixels of an image..

It can accept hexadecimal, combination of (Red, Blue, Green) and (Red, Blue, Green, Alpha)

## auto

Specify the version number of the asset that you wish to retrieve. If the version is not specified, the details of the latest version will be retrieved.

auto parameter is set to webp

The format

## ContentType

Content provides an instance of and entry and query

## fetch

This call returns information of a specific content type. It returns the content type schema, but does not include its entries.

The Query Parameters

## entry

This function provide option to get single entry as well as all the entries

the entry uid

## find

This call returns comprehensive information of all the content types available in a particular stack in your account.

Query parameters

## includeGlobalField

This method includes the Global field's schema along with the content type schema.

## includeCount

This method includes the includeCount method facilitate to find the total count of content types available in your stack.

## Entry

The Entry provides data based on entry uid

## only

Specifies an array of only keys in BASE object that would be included in the response.

The field uid is list of string

## locale

This method also includes the content type UIDs of the referenced entries returned in the response.

The locale code

## includeReferenceContentTypeUID

This method also includes the content type UIDs of the referenced entries returned in the response.

## includeReference

Include Reference: When you fetch an entry of a content type that has a reference field, by default, the content of the referred entry is not fetched. It only fetches the UID of the referred entry, along with the content of the specified entry.

referenceFieldUid Key who has reference to some other class object

includeReference provides three options, none, only and except

## includeBranch

Includes branch in the response

## includeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details

## includeFallback

Retrieve the published content of the fallback locale if an entry is not localized in specified locale.

## includeContentType

Include Content Type of all returned objects along with objects themselves

## except

Specifies list of field uids that would be excluded from the response.

field uid which get excluded from the response

## addParam

This method adds key and value to an Entry.

The key as string which needs to be added to an Entry

The value as string which needs to be added to an Entry

## Query

The Query provides entries based on queries applied

## where

Get entries containing the field values matching the condition in the query.

The field uid

The QueryOperation

## skip

The number of objects to skip before returning any.

No of objects to skip from returned objects

## query

Add a custom query against specified key.

key for the query

value for the query

## param

This method adds key and value to an Entry.

key by which you can sort the results in descending order

value of the param against the key

## orderByDescending

Sort the results in descending order with the given key.

key by which you can sort the results in descending order

## orderByAscending

sort the results in ascending order with the given key.

key by which you can sort the results in ascending order

## limit

A limit on the number of objects to return.

the count you want to limit your response

## addQuery

Add a custom query against specified key. parameters The key and value pair that will be added to the Query

comma-separated string value

## addParams

This method adds key and value to the Query as Query parameter.

Key of the query parameter

Value of the Query parameter against the key

## includeBranch

includes branch in the response

## whereReference

Get entries having values based on referenced fields This query retrieves all entries that satisfy the query conditions made on referenced fields.

The referenced uid

It accepts Enum type QueryReference.include() OR QueryReference.NotInclude() and it accepts instance of Query

## setHeader

adds header to the request

key of the header

value of the header against the key

## removeHeader

Removed header from the request by key

key of the header

## operator

entries that satisfy at least one of the given conditions provided

QueryOperator using and/or functions that accepts list of queries

## only

provides data that contains only mentinoed keywords

Array of the only reference keys to be included in response

## locale

\[locale\] is the code of the language in which the entries need to be included.

\[locale\] is code of the language of which the entries needs to be included.

## includeReferenceContentTypeUID

This method also includes the content type UIDs of the referenced entries returned in the response

## includeReference

When you fetch an entry of a content type that has a reference field, by default, the content of the referred entry is not fetched. It only fetches the UID of the referred entry, along with the content of the specified entry

Key who has reference to some other class object

provides three options, none, only and except i.e accepts list of fieldUid

## includeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details

## includeFallback

Retrieve the published content of the fallback locale if an entry is not localized in specified locale.

## includeContentType

Include Content Type of all returned objects along with objects

## except

Specifies list of field uids that would be excluded from the response. \[fieldUid\] field uid which get excluded from the response.

fieldUid is String type of List

## addParam

This method adds key and value to an Entry.

key of the parameter

value of the param against the key