Query class

Contentstack provides certain queries that you can use to fetch filtered results. You can use queries for Entries and Assets API requests. Learn more about Query

Constructors

Query([HttpClient _client, String _contentTypeUid])

Properties

hashCode int
The hash code for this object.
read-only, inherited
parameter Map<String, dynamic>
final, inherited
queryParameter Map<String, String>
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addParam(String key, String value) → void
This method adds key and value to an Entry. key The key as string which needs to be added to an Entry value The value as string which needs to be added to an Entry Query object, so you can chain this call.
addParams(Map parameters) → void
This method adds key and value to an Entry. parameters The key and value pair that will be added to the Query
inherited
addQuery(Map parameters) → void
Add a custom query against specified key. parameters The key and value pair that will be added to the Query
inherited
except(List<String> fieldUid) → void
Specifies list of field uids that would be excluded from the response. fieldUid field uid which get excluded from the response. Query object, so you can chain this call.
find<T, K>() Future<T>
getQueryUrl() Map
includeBranch() → void
includes branch in the response
includeContentType() → void
Include Content Type of all returned objects along with objects themselves. return, Query so you can chain this call.
includeEmbeddedItems() → void
includeEmbeddedItems instance of Query Include Embedded Objects (Entries and Assets) along with entry/entries details
includeFallback() → void
Retrieve the published content of the fallback locale if an entry is not localized in specified locale.
includeReference(String referenceFieldUid, {Include includeReferenceField}) → void
  • 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.
  • includeReferenceContentTypeUID() → void
    This method also includes the content type UIDs of the referenced entries returned in the response return Query so you can chain this call
    limit(int limitCount) → void
    A limit on the number of objects to return. limitCount No of objects to limit you can chain this call by using double dot The limit parameter can be used for pagination, limit specifies the number of objects to limit to in the response.
    inherited
    locale(String locale) → void
    locale is code of the language of which the entries needs to be included. Only the entries published in this locale will be fetched.
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a non-existent method or property is accessed.
    inherited
    only(List<String> fieldUid) → void
    ////////////////////////////////////////////// ////////////////////////////////////////////// Specifies an array of only keys in BASE object that would be included in the response. fieldUid Array of the only reference keys to be included in response. Query object, so you can chain this call.
    operator(QueryOperator operator) → void
  • AND Operator Get entries that satisfy all the conditions provided in the '$and' query.

  • OR Operator Get all entries that satisfy at least one of the given conditions provided in the '$or' query.

  • {Example}: operator OR

  • orderByAscending(String key) → void
    Sort the results in ascending order with the given key. Sort the returned entries in ascending order of the provided key. key The key to order by. you can chain this call by using double dot
    inherited
    orderByDescending(String key) → void
    Sort the results in descending order with the given key. Sort the returned entries in descending order of the provided key. key The key to order by. you can chain this call by using double dot
    inherited
    param(String key, String value) → void
    This method adds key and value to an Entry. key The key as string which needs to be added to the Query value The value as string which needs to be added to the Query
    inherited
    query(String key, String value) → void
    Add a custom query against specified key. key key for the query value value for the query
    inherited
    removeHeader(String key) → void
    Remove header key key custom header key
    setHeader(String key, String value) → void
    To set headers for Built.io Contentstack rest calls. Scope is limited to this object and followed classes. key header name. value header value against given header name.
    skip(int skipCount) → void
    The number of objects to skip before returning any. skipCount No of objects to skip from returned objects you can chain this call using double dot.
    inherited
    toString() String
    A string representation of this object.
    inherited
    where(String fieldUid, QueryOperation queryOperation) → void
    inherited
    whereReference(String referenceUid, QueryReference reference) → void
  • Reference Search Equals: Get entries having values based on referenced fields. This query retrieves all entries that satisfy the query conditions made on referenced fields.

  • Reference Search Not-equals: Get entries having values based on referenced fields. This query works the opposite of $in_query and retrieves all entries that does not satisfy query conditions made on referenced fields.

  • referenceUid is Reference field

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

  • Operators

    operator ==(Object other) bool
    The equality operator.
    inherited