setHeader method

void setHeader(
  1. String key,
  2. String value
)

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.

Example:

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

Implementation

void setHeader(String key, String value) {
  if (key.isNotEmpty && value.isNotEmpty) {
    _client.stackHeaders[key] = value;
  }
}