http library

HTTP client annotations and runtime exports for Dust.

Classes

AsciiCodec
Encoding and decoding of ASCII characters.
AsciiDecoder
Converts ASCII bytes to string.
AsciiEncoder
Converts strings of only ASCII characters to bytes.
Base64Codec
A base64 encoder and decoder.
Base64Decoder
Decoder for base64 encoded data.
Base64Encoder
Base64 and base64url encoding converter.
Body
Encodes the parameter as the request body.
BoolList
A space-efficient list of boolean values.
ByteConversionSink
The ByteConversionSink provides an interface for converters to efficiently transmit byte data.
CancelToken
Controls cancellation of Dio's requests.
CanonicalizedMap<C, K, V>
A map whose keys are converted to canonical values of type C.
CaseInsensitiveEquality
String equality that's insensitive to differences in ASCII case.
ChunkedConversionSink<T>
A ChunkedConversionSink is used to transmit data more efficiently between two converters during chunked conversions.
ClosableStringSink
A ClosableStringSink extends the StringSink interface by adding a close method.
Codec<S, T>
A Codec encodes and (if supported) decodes data.
CombinedIterableView<T>
A view of several iterables combined sequentially into a single iterable.
CombinedListView<T>
A view of several lists combined into a single list.
CombinedMapView<K, V>
Returns a new map that represents maps flattened into a single map.
Converter<S, T>
A Converter converts data from one representation into another.
CopyWith
Generates typed copyWith support.
Debug
Deprecated alias for ToString().
DeepCollectionEquality
Deep equality on collections.
DefaultEquality<E>
Equality of objects that compares only the natural equality of the objects.
DelegatingIterable<E>
An Iterable that delegates all operations to a base iterable.
DelegatingList<E>
A List that delegates all operations to a base list.
DelegatingMap<K, V>
A Map that delegates all operations to a base map.
DelegatingQueue<E>
A Queue that delegates all operations to a base queue.
DelegatingSet<E>
A Set that delegates all operations to a base set.
DELETE
Marks a method as an HTTP DELETE endpoint.
Derive
Declares which traits Dust should generate for the annotated declaration.
DeriveConfig
Base marker for derive configuration annotations.
DeriveMeta
Base marker for all Dust derive annotations.
DeriveTrait
Base marker for derive traits listed inside @Derive([...]).
Deserialize
Generates _$TypeDeserialize(...) and _$TypeFromJson(...) support.
Deserializer<DartT, JsonT>
Directional conversion contract for generated and custom deserializers.
Dio
Dio enables you to make HTTP requests easily.
Encoding
Open-ended set of encodings.
Eq
Generates value equality through operator == and matching hashCode.
Equality<E>
A generic equality relation on objects.
EqualityBy<E, F>
Equality of objects based on derived values.
EqualityMap<K, V>
A Map whose key equality is determined by an Equality object.
EqualitySet<E>
A Set whose key equality is determined by an Equality object.
Err<T, E>
Failed operation result.
Extra
Maps a parameter to RequestOptions.extra.
Field
Adds a field to application/x-www-form-urlencoded. Requires @FormUrlEncoded on the method.
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
FormUrlEncoded
Sets content-type to application/x-www-form-urlencoded.
GET
Marks a method as an HTTP GET endpoint.
Marks a method as an HTTP HEAD endpoint.
Maps a parameter to a request header.
HeaderMap
Maps a Map<String, String> parameter to multiple request headers.
Headers
Method-level annotation for static headers.
HeapPriorityQueue<E>
Heap based priority queue.
HtmlEscape
Converter which escapes characters with special meaning in HTML.
HtmlEscapeMode
HTML escape modes.
HttpClient
Annotation for a class to generate a Dio-backed HTTP client.
HttpMethod
Base class for HTTP method annotations.
HttpParse
Overrides the class-level parsing strategy for a single method.
IdentityEquality<E>
Equality of objects that compares only the identity of the objects.
Invalid
Failed validation result.
IterableEquality<E>
Equality on iterables.
IterableZip<T>
Iterable that iterates over lists of values from other iterables.
JsonCodec
A JsonCodec encodes JSON objects to strings and decodes strings to JSON objects.
JsonDecoder
This class parses JSON strings and builds the corresponding objects.
JsonEncoder
This class converts JSON objects to strings.
JsonHelper
Shared runtime helpers used by Dust-generated serde code.
JsonUtf8Encoder
Encoder that encodes a single object as a UTF-8 encoded JSON string.
Latin1Codec
A Latin1Codec encodes strings to ISO Latin-1 (aka ISO-8859-1) bytes and decodes Latin-1 bytes to strings.
Latin1Decoder
This class converts Latin-1 bytes (lists of unsigned 8-bit integers) to a string.
Latin1Encoder
This class converts strings of only ISO Latin-1 characters to bytes.
Length
Type-safe length validator configuration.
LineSplitter
A StreamTransformer that splits a String into individual lines.
ListEquality<E>
Equality on lists.
ListSlice<E>
A list view of a range of another list.
MapEquality<K, V>
Equality on maps.
MapKeySet<E>
An unmodifiable Set view of the keys of a Map.
MapValueSet<K, V>
Creates a modifiable Set view of the values of a Map.
MultiEquality<E>
Combines several equalities into a single equality.
MultiPart
Sets content-type to multipart/form-data.
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
None<T>
Option state for an absent value.
NonGrowableListMixin<E>
Mixin class that implements a throwing version of all list operations that change the List's length.
NonGrowableListView<E>
A fixed-length list.
Ok<T, E>
Successful operation result.
Option<T>
Optional value wrapper for Rust-style present-or-absent values.
OPTIONS
Marks a method as an HTTP OPTIONS endpoint.
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
Part
Adds a part to multipart/form-data. Requires @MultiPart on the method.
PATCH
Marks a method as an HTTP PATCH endpoint.
Path
Maps a parameter to a {name} placeholder in the URL path.
POST
Marks a method as an HTTP POST endpoint.
PriorityQueue<E>
A priority queue is a priority based work-list of elements.
PUT
Marks a method as an HTTP PUT endpoint.
Queries
Maps a Map<String, dynamic> parameter to multiple query parameters.
Query
Adds a query parameter to the URL.
QueueList<E>
A class that efficiently implements both Queue and List.
Range
Type-safe numeric range validator configuration.
RequestOptions
The internal request option class that is the eventual result after BaseOptions and Options are composed.
Response<T>
The Response class contains the payload (could be transformed) that respond from the request, and other information of the response.
ResponseBody
The response wrapper class for adapters.
Result<T, E>
Result of an operation that can either succeed with T or fail with E.
SerDe
Configures how Dust generates or interprets serde metadata.
SerDeCodec<DartT, JsonT>
Field-level conversion contract for custom Dust serde handling.
Serializable
Instance contract generated for classes deriving Serialize.
Serialize
Generates serialize() and toJson() support for the annotated class or enum.
Serializer<DartT, JsonT>
Directional conversion contract for generated and custom serializers.
SetEquality<E>
Equality of sets.
Some<T>
Option state for a present value.
StringConversionSink
A sink for converters to efficiently transmit String data.
ToString
Generates a toString() implementation from the class fields.
UnionSet<E>
A single set that provides a view of the union over a set of sets.
UnionSetController<E>
A controller that exposes a view of the union of a collection of sets.
Unit
Empty success value for operations that only signal completion.
UnmodifiableListView<E>
An unmodifiable List view of another List.
UnmodifiableMapMixin<K, V>
Mixin class that implements a throwing version of all map operations that change the Map.
UnmodifiableMapView<K, V>
View of a Map that disallow modifying the map.
UnmodifiableSetMixin<E>
Mixin class that implements a throwing version of all set operations that change the Set.
UnmodifiableSetView<E>
An unmodifiable set.
UnorderedIterableEquality<E>
Equality of the elements of two iterables without considering order.
Utf8Codec
A Utf8Codec encodes strings to utf-8 code units (bytes) and decodes UTF-8 code units to strings.
Utf8Decoder
This class converts UTF-8 code units (lists of unsigned 8-bit integers) to a string.
Utf8Encoder
This class converts strings to their UTF-8 code units (a list of unsigned 8-bit integers).
Valid
Successful validation result.
Validatable
Runtime contract implemented by generated Validate() mixins.
Validate<T>
Generates validation methods and configures field validators.
ValidationError
One validation failure.
ValidationHelper
Shared helpers used by generated validation code.
ValidationResult
Result returned by generated validation.

Enums

HttpParseThread
Defines the thread context for JSON parsing.
HttpTarget
Defines the runtime target for generated HTTP clients.
ResponseType
Indicates which transformation should be applied to the response data.
SerDeRename
The rename strategy used when Dust derives JSON keys automatically.

Extensions

ComparatorExtension on Comparator<T>
Extensions on comparator functions.
DeserializerJsonMirror on Deserializer<DartT, JsonT>
Dart ecosystem mirrors for deserializers.
IterableComparableExtension on Iterable<T>
Extensions that apply to iterables of Comparable elements.
IterableDoubleExtension on Iterable<double>
Extension on iterables of double.
IterableExtension on Iterable<T>
Extensions that apply to all iterables.
IterableIntegerExtension on Iterable<int>
Extension on iterables of integers.
IterableIterableExtension on Iterable<Iterable<T>>
Extensions on iterables whose elements are also iterables.
IterableNullableExtension on Iterable<T?>
Extensions that apply to iterables with a nullable element type.
IterableNumberExtension on Iterable<num>
Extensions that apply to iterables of numbers.
ListComparableExtensions on List<E>
Various extensions on lists of comparable elements.
ListExtensions on List<E>
Various extensions on lists of arbitrary elements.
SerializerJsonMirror on Serializer<DartT, JsonT>
Dart ecosystem mirrors for serializers.

Constants

ascii → const AsciiCodec
An instance of the default implementation of the AsciiCodec.
base64 → const Base64Codec
A base64 encoder and decoder.
base64Url → const Base64Codec
A base64url encoder and decoder.
htmlEscape → const HtmlEscape
A String converter that converts characters to HTML entities.
json → const JsonCodec
An instance of the default implementation of the JsonCodec.
latin1 → const Latin1Codec
An instance of the default implementation of the Latin1Codec.
unicodeBomCharacterRune → const int
The Unicode Byte Order Marker (BOM) character U+FEFF.
unicodeReplacementCharacterRune → const int
The Unicode Replacement character U+FFFD (�).
unit → const Unit
Shared unit value.
utf8 → const Utf8Codec
An instance of the default implementation of the Utf8Codec.

Functions

base64Decode(String source) Uint8List
Decodes base64 or base64url encoded bytes.
base64Encode(List<int> bytes) String
Encodes bytes using base64 encoding.
base64UrlEncode(List<int> bytes) String
Encodes bytes using base64url encoding.
binarySearch<E>(List<E> sortedList, E value, {int compare(E, E)?}) int
Returns a position of the value in sortedList, if it is there.
compareAsciiLowerCase(String a, String b) int
Compares a and b lexically, converting ASCII letters to lower case.
compareAsciiLowerCaseNatural(String a, String b) int
Compares strings a and b according to lower-case natural sort ordering.
compareAsciiUpperCase(String a, String b) int
Compares a and b lexically, converting ASCII letters to upper case.
compareAsciiUpperCaseNatural(String a, String b) int
Compares strings a and b according to upper-case natural sort ordering.
compareNatural(String a, String b) int
Compares strings a and b according to natural sort ordering.
equalsIgnoreAsciiCase(String a, String b) bool
Checks if strings a and b differ only on the case of ASCII letters.
groupBy<S, T>(Iterable<S> values, T key(S)) Map<T, List<S>>
Groups the elements in values by the value returned by key.
hashIgnoreAsciiCase(String string) int
Hash code for a string which is compatible with equalsIgnoreAsciiCase.
insertionSort<E>(List<E> elements, {int compare(E, E)?, int start = 0, int? end}) → void
Sort a list between start (inclusive) and end (exclusive) using insertion sort.
jsonDecode(String source, {Object? reviver(Object? key, Object? value)?}) → dynamic
Parses the string and returns the resulting Json object.
jsonEncode(Object? object, {Object? toEncodable(Object? nonEncodable)?}) String
Converts object to a JSON string.
lastBy<S, T>(Iterable<S> values, T key(S)) Map<T, S>
Associates the elements in values by the value returned by key.
lowerBound<E>(List<E> sortedList, E value, {int compare(E, E)?}) int
Returns the first position in sortedList that does not compare less than value.
mapMap<K1, V1, K2, V2>(Map<K1, V1> map, {K2 key(K1, V1)?, V2 value(K1, V1)?}) Map<K2, V2>
Creates a new map from map with new keys and values.
maxBy<S, T>(Iterable<S> values, T orderBy(S), {int compare(T, T)?}) → S?
Returns the element of values for which orderBy returns the maximum value.
mergeMaps<K, V>(Map<K, V> map1, Map<K, V> map2, {V value(V, V)?}) Map<K, V>
Returns a new map with all key/value pairs in both map1 and map2.
mergeSort<E>(List<E> elements, {int start = 0, int? end, int compare(E, E)?}) → void
Sorts a list between start (inclusive) and end (exclusive) using the merge sort algorithm.
minBy<S, T>(Iterable<S> values, T orderBy(S), {int compare(T, T)?}) → S?
Returns the element of values for which orderBy returns the minimum value.
reverse<E>(List<E> elements, [int start = 0, int? end]) → void
Reverses a list, or a part of a list, in-place.
shuffle(List elements, [int start = 0, int? end, Random? random]) → void
Shuffles a list randomly.
stronglyConnectedComponents<T>(Map<T, Iterable<T>> graph) List<Set<T>>
Returns the strongly connected components of graph, in topological order.
transitiveClosure<T>(Map<T, Iterable<T>> graph) Map<T, Set<T>>
Returns the transitive closure of graph.

Typedefs

ByteConversionSinkBase = ByteConversionSink
This class provides a base-class for converters that need to accept byte inputs.
FieldValidator<T> = ValidationError? Function(T value)
Custom validator callback used by field-level @Validate(custom: ...).
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
StringConversionSinkBase = StringConversionSink
This class provides a base-class for converters that need to accept String inputs.
StringConversionSinkMixin = StringConversionSink
This class provides a mixin for converters that need to accept String inputs.

Exceptions / Errors

JsonCyclicError
Reports that an object could not be stringified due to cyclic references.
JsonUnsupportedObjectError
Error thrown by JSON serialization if an object cannot be serialized.
ValidationException
Exception thrown by generated validateOrThrow().