---
title: "Query"
description: "Query"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/dart/reference/query"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-20"
---

# Query

## Query

The Query provides entries based on queries applied

## where

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

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.where("fieldUid", QueryOperation);
```

The field uid

The QueryOperation

## skip

The number of objects to skip before returning any.

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.skip(4);
```

No of objects to skip from returned objects

## query

Add a custom query against specified key.

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.addQuery("param_key", "param_value");
```

key for the query

value for the query

## param

This method adds key and value to an Entry.

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.param("Key", "Value");
```

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.

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.orderByDescending("descendingKey");
```

key by which you can sort the results in descending order

## orderByAscending

sort the results in ascending order with the given key.

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.ascending("ascKey");
```

key by which you can sort the results in ascending order

## limit

A limit on the number of objects to return.

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.limit(2);
```

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

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.addParams("keyword1", "keyword2", "keyword3");
```

comma-separated string value

## addParams

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

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('contentType').entry().query();
query.addParam("Key", "Value")
```

Key of the query parameter

Value of the Query parameter against the key

## includeBranch

includes branch in the response

```
import Contentstack

final stack = contentstack.stack(apiKey, delieveryToken, environment)
final query = stack.contentType('room').entry().query();
query.includeBranch()
```

## whereReference

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

```
import Contentstack
final query = stack.contentType('room').entry().query();
query.referenceSearch('fieldUid', QueryReference.include(query: query));
  await query.find().then((response){
    print(response);
});
```

The referenced uid

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

## setHeader

adds header to the request

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.setHeader("key", "value")
```

key of the header

value of the header against the key

## removeHeader

Removed header from the request by key

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.removeHeader("key")
```

key of the header

## operator

entries that satisfy at least one of the given conditions provided

```
import Contentstack
final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");final query = stack.contentType('contentTypeUid').entry().query();query.operator(QueryOperator.OR);
final stackInstance1 = Credential.stack(); final queryBase1 = stackInstance1.contentType('room').entry().query(); queryBase1.where('title', QueryOperation.equals(value: 'Room 13')); 
final stackInstance2 = Credential.stack(); final queryBase2 = stackInstance2.contentType('room').entry().query(); queryBase2.where('attendee', QueryOperation.equals(value: 20)); 
final List listOfQuery = [queryBase1, queryBase2]; 
query.operator(QueryOperator.or(queryObjects: listOfQuery));
await query.find().then((response)
{ 
  print(response.toString()); 
}).catchError((onError){ 
  print(onError); 
});
```

QueryOperator using and/or functions that accepts list of queries

## only

provides data that contains only mentinoed keywords

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.only(fieldUid);
```

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.

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.locale("locale_code");
```

\[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

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.includeReferenceContentTypeUID();
```

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

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.includeReference("referenceFieldUid", IncludeReference.except(fieldUidList: fieldUid));;
```

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

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.includeEmbeddedItems();
```

## includeFallback

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

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.includeFallback();
```

## includeContentType

Include Content Type of all returned objects along with objects

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.includeContentType();
```

## except

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

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
query.except(fieldUid);
```

fieldUid is String type of List

## addParam

This method adds key and value to an Entry.

```
import Contentstack

final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
final query = stack.contentType('contentTypeUid').entry().query();
entry.addParam("key", "value");
```

key of the parameter

value of the param against the key

## Query | Dart Delivery SDK | Contentstack

Query returns entries based on the conditions you apply in the Dart Delivery SDK, letting you filter and fetch content from a content type.