Stack class

A stack is like a container that holds the content of your app. Learn more about Stacks.

Constructors

Stack(String _apiKey, String _deliveryToken, String _environment, {String apiVersion = 'v3', Region region = Region.us, String branch, String host = 'cdn.contentstack.io', BaseClient client, Map<String, dynamic> livePreview})
Create a new Stack instance with stack's apikey, token, environment name and Optional parameters like. Throws an ArgumentError if apiKey, deliveryToken and environment is not passed. Optional Parameters: apiVersion: (Optional) apiVersion for the api region: (Optional) region is type of Region i.e US and EU host: (Optional) host is the host for the api client: (Optional) if developer wants to set their own client instance livePreview: (Optional) enables livePreview for entry/query provide livePreview object like below.

Properties

apiKey String
It returns apiKey of the Stack
read-only
apiVersion String
final
branch String
final
deliveryToken String
It returns delivery token of the Stack
read-only
endpoint String
It returns endpoint of the Stack
read-only
environment String
It returns delivery token of the Environment
read-only
getLivePreview Map
It returns livePreview variables
read-only
hashCode int
The hash code for this object.
read-only, inherited
headers Map<String, String>
read / write
host String
It returns host of the Stack
read-only
livePreview Map<String, dynamic>
read / write
region Region
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

asset(String uid) Asset
This call fetches the latest version of a specific asset of a particular stack. API Reference : https://www.contentstack.com/docs/developers/apis/content-delivery-api/#single-asset uid assetUid
assetQuery() → AssetQuery
This call fetches the list of all the assets of a particular stack. It also returns the content of each asset in JSON format. You can also specify the environment of which you wish to get the assets. API Reference : https://www.contentstack.com/docs/developers/apis/content-delivery-api/#all-assets
contentType([String contentTypeId]) ContentType
ContentType accepts contentTypeId in as the parameter Returns instance of ContentType. contentType takes contentTypeId as optional parameter If you want get one contentType by their content_type_uid
getContentTypes<T, K>(Map queryParameters) Future<T>
Fetches all Content Types from the Stack. This call returns comprehensive information of all the content types available in a particular stack in your account. API Reference: https://www.contentstack.com/docs/developers/apis/content-delivery-api/#content-types queryParameters is query parameters for the content_types of type Map returns list of content_types
globalField<T, K>([String globalFieldUid, bool includeBranch = false]) Future<T>
All Global Fields
imageTransform(String imageUrl) ImageTransformation
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. {Supported input formats}: JPEG, PNG, WEBP, GIF {Supported output formats}: JPEG (baseline & progressive), PNG, WEBP (lossy & lossless), GIF Read documentation for more details: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#limitations-with-optimizing-image
livePreviewQuery(Map<String, dynamic> livePreviewQuery) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
paginationToken<T, K>(String paginationToken) Future<T>
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.
removeHeader(String headerKey) → void
removeHeader function is to Remove header by headerKey It requires header key to delete the header returns Stack Instance
setHeader(String key, String value) → void
Adds headers for the request
setHost(String host) → void
Adds host for the request
sync<T, K>({String contentTypeUid, String fromDate, String locale, PublishType publishType}) Future<T>
////////////////////////////////////////////// //////////////////////////////////////////////
syncToken<T, K>(String syncToken) Future<T>
You can use the sync token (that you receive after initial sync) to get the updated content next time. sync token fetches only the content that was added after your last sync, and the details of the content that was deleted or updated.
toString() String
A string representation of this object.
inherited

Operators

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