Header class abstract

Describes a single header for HTTP responses and multipart parts.

According to OpenAPI v3.0 spec: name and in are omitted, style limited to "simple".

Available extensions
Annotations
  • @Freezed.new(copyWith: true, fromJson: true, toJson: true, equal: true)

Constructors

Header({String? description, bool? required, bool? deprecated, String? style, bool? explode, Schema? schema, dynamic example, Map<String, Example>? examples, Map<String, MediaType>? content, @JsonKey.new(name: r'$ref') String? ref})
Creates a new instance of the Header class.
const
factory
Header.fromJson(Map<String, dynamic> json)
Creates a new instance of the Header class from a JSON object.
factory

Properties

content → Map<String, MediaType>?
A map containing the representations for the header. Must only contain one entry.
no setterinherited
copyWith → $HeaderCopyWith<Header>
Create a copy of Header with the given fields replaced by the non-null parameter values.
no setterinherited
deprecated → bool?
Specifies that the header is deprecated and SHOULD be transitioned out of usage. Default is false.
no setterinherited
description → String?
A brief description of the header.
no setterinherited
example → dynamic
Example of the header's potential value.
no setterinherited
examples → Map<String, Example>?
Examples of the header's potential value.
no setterinherited
explode → bool?
When true, header values of type array or object generate a single header whose value is a comma-separated list.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
ref → String?
Reference to a header object.
no setterinherited
required → bool?
Determines whether this header is mandatory. Default is false.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schema → Schema?
The schema defining the type used for the header.
no setterinherited
style → String?
Describes how the header value will be serialized. Only "simple" is allowed for headers.
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_Header value)) → TResult

Available on Header, provided by the HeaderPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_Header value)?) → TResult?

Available on Header, provided by the HeaderPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_Header value)?, {required TResult orElse()}) → TResult

Available on Header, provided by the HeaderPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(String? description, bool? required, bool? deprecated, String? style, bool? explode, Schema? schema, dynamic example, Map<String, Example>? examples, Map<String, MediaType>? content, String? ref)?, {required TResult orElse()}) → TResult

Available on Header, provided by the HeaderPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Serializes this Header to a JSON map.
inherited
toString() → String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(String? description, bool? required, bool? deprecated, String? style, bool? explode, Schema? schema, dynamic example, Map<String, Example>? examples, Map<String, MediaType>? content, String? ref)) → TResult

Available on Header, provided by the HeaderPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(String? description, bool? required, bool? deprecated, String? style, bool? explode, Schema? schema, dynamic example, Map<String, Example>? examples, Map<String, MediaType>? content, String? ref)?) → TResult?

Available on Header, provided by the HeaderPatterns extension

A variant of when that fallback to returning null

Operators

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