better_networking library

Classes

Abortable
An HTTP request that can be aborted before it completes.
AbortableMultipartRequest
A MultipartRequest which supports abortion using abortTrigger.
AbortableRequest
A Request which supports abortion using abortTrigger.
AbortableStreamedRequest
A StreamedRequest which supports abortion using abortTrigger.
AuthApiKeyModel
AuthBasicAuthModel
AuthBearerModel
AuthDigestModel
AuthenticationChallenge
A single challenge in a WWW-Authenticate header, parsed as per RFC 2617.
AuthJwtModel
AuthModel
BaseClient
The abstract base class for an HTTP client.
BaseRequest
The base class for HTTP requests.
BaseResponse
The base class for HTTP responses.
BaseResponseWithUrl
A BaseResponse with a url field.
BoolList
A space-efficient list of boolean values.
ByteStream
A stream of chunks of bytes representing a single piece of data.
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.
CaseInsensitiveMap<V>
A map from case-insensitive strings to values.
ChunkedCodingCodec
A codec that encodes and decodes the chunked transfer coding.
ChunkedCodingDecoder
A converter that decodes byte arrays into chunks with size tags.
ChunkedCodingEncoder
A converter that encodes byte arrays into chunks with size tags.
Client
The interface for HTTP clients that take care of maintaining persistent connections across multiple requests to the same server.
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.
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.
DurationConverter
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.
FormDataModel
HeapPriorityQueue<E>
Heap based priority queue.
HttpClientManager
HttpRequestModel
HttpResponseModel
IdentityEquality<E>
Equality of objects that compares only the identity of the objects.
IterableEquality<E>
Equality on iterables.
IterableZip<T>
Iterable that iterates over lists of values from other iterables.
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.
MediaType
A class representing an HTTP media type, as used in Accept and Content-Type headers.
MultiEquality<E>
Combines several equalities into a single equality.
MultipartFile
A file to be uploaded as part of a MultipartRequest.
MultipartRequest
A multipart/form-data request.
NameValueModel
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.
PriorityQueue<E>
A priority queue is a priority based work-list of elements.
QueueList<E>
A class that efficiently implements both Queue and List.
Request
An HTTP request where the entire request body is known in advance.
Response
An HTTP response where the entire response body is known in advance.
SetEquality<E>
Equality of sets.
StreamedRequest
An HTTP request where the request body is sent asynchronously after the connection has been established and the headers have been sent.
StreamedResponse
An HTTP response where the response body is received asynchronously after the headers have been received.
Uint8ListConverter
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.
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.

Extensions

ComparatorExtension on Comparator<T>
Extensions on comparator functions.
HeadersWithSplitValues on BaseResponse
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.
MapExtension on Map

Constants

chunkedCoding → const ChunkedCodingCodec
The canonical instance of ChunkedCodingCodec.
kCodeCharsPerLineLimit → const int
kDefaultContentType → const ContentType
kDefaultHttpMethod → const HTTPVerb
kDefaultUriScheme → const SupportedUriSchemes
kDigestAlgos → const List<String>
kFormDataEmptyModel → const FormDataModel
kHeaderContentType → const String
kHeaderWwwAuthenticate → const String
kJsonDecoder → const JsonDecoder
kJsonEncoder → const JsonEncoder
kJwtAlgos → const List<String>
kMethodsWithBody → const List<HTTPVerb>
kMsgRequestCancelled → const String
kNameValueEmptyModel → const NameValueModel
kQop → const List<String>
kSplitter → const LineSplitter
kSubTypeCss → const String
kSubTypeCsv → const String
kSubTypeDefaultViewOptions → const String
kSubTypeEventStream → const String
kSubTypeFormData → const String
kSubTypeHtml → const String
kSubTypeJavascript → const String
kSubTypeJson → const String
kSubTypeJsonSeq → const String
kSubTypeJsonStream → const String
kSubTypeJsonstream → const String
kSubTypeLdjson → const String
kSubTypeMarkdown → const String
kSubTypeNdjson → const String
kSubTypeOctetStream → const String
kSubTypePdf → const String
kSubTypePlain → const String
kSubTypeSql → const String
kSubTypeStreamJson → const String
kSubTypeSvg → const String
kSubTypeTextXml → const String
kSubTypeTextYaml → const String
kSubTypeTextYml → const String
kSubTypeXJsonStream → const String
kSubTypeXLdjson → const String
kSubTypeXml → const String
kSubTypeXNdjson → const String
kSubTypeXWwwFormUrlencoded → const String
kSubTypeXYaml → const String
kSubTypeYaml → const String
kSubTypeYml → const String
kTypeApplication → const String
kTypeAudio → const String
kTypeImage → const String
kTypeMultipart → const String
kTypeText → const String
kTypeVideo → const String

Functions

binarySearch<E>(List<E> sortedList, E value, {int compare(E, E)?}) int
Returns a position of the value in sortedList, if it is there.
cancelHttpRequest(String? requestId) → void
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.
convertStreamedResponse(StreamedResponse streamedResponse) Future<Response>
createHttpClientWithNoSSL() Client
delete(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP DELETE request with the given headers to the given URL.
equalsIgnoreAsciiCase(String a, String b) bool
Checks if strings a and b differ only on the case of ASCII letters.
formatBody(String? body, MediaType? mediaType) String?
formatHttpDate(DateTime date) String
Return a HTTP-formatted string representation of date.
get(Uri url, {Map<String, String>? headers}) Future<Response>
Sends an HTTP GET request with the given headers to the given URL.
getContentTypeFromContentTypeStr(String? contentType) ContentType?
getContentTypeFromHeadersMap(Map<String, String>? kvMap) ContentType?
getContentTypeFromMediaType(MediaType? mediaType) ContentType?
getEnabledRows(List<NameValueModel>? rows, List<bool>? isRowEnabledList) List<NameValueModel>?
getFormDataType(String? type) FormDataType
getGraphQLBody(HttpRequestModel httpRequestModel) String?
getMediaTypeFromContentType(String? contentType) MediaType?
getMediaTypeFromHeaders(Map? headers) MediaType?
getRequestBody(APIType type, HttpRequestModel httpRequestModel) String?
getUriScheme(Uri uri) → (String?, bool)
getValidRequestUri(String? url, List<NameValueModel>? requestParams, {SupportedUriSchemes defaultUriScheme = kDefaultUriScheme}) → (Uri?, String?)
groupBy<S, T>(Iterable<S> values, T key(S)) Map<T, List<S>>
Groups the elements in values by the value returned by key.
handleAuth(HttpRequestModel httpRequestModel, AuthModel? authData) Future<HttpRequestModel>
hashIgnoreAsciiCase(String string) int
Hash code for a string which is compatible with equalsIgnoreAsciiCase.
Sends an HTTP HEAD request with the given headers to the given URL.
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.
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.
makeStreamedRequest({required Client client, required Uri uri, required HttpRequestModel requestModel, required APIType apiType}) Future<StreamedResponse>
mapListToFormDataModelRows(List<Map>? kvMap) List<FormDataModel>?
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.
mapToRows(Map<String, String>? kvMap) List<NameValueModel>?
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.
parseHttpDate(String date) DateTime
Parses an HTTP-formatted date into a UTC DateTime.
patch(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP PATCH request with the given headers and body to the given URL.
post(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP POST request with the given headers and body to the given URL.
prepareHttpRequest({required Uri url, required String method, required Map<String, String> headers, required String? body, bool overrideContentType = false}) Request
put(Uri url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
Sends an HTTP PUT request with the given headers and body to the given URL.
read(Uri url, {Map<String, String>? headers}) Future<String>
Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a String.
readBytes(Uri url, {Map<String, String>? headers}) Future<Uint8List>
Sends an HTTP GET request with the given headers to the given URL and returns a Future that completes to the body of the response as a list of bytes.
removeJsonComments(String? json) String?
reverse<E>(List<E> elements, [int start = 0, int? end]) → void
Reverses a list, or a part of a list, in-place.
rowsToFormDataMapList(List<FormDataModel>? kvRows) List<Map<String, String>>?
rowsToMap(List<NameValueModel>? kvRows, {bool isHeader = false}) Map<String, String>?
runWithClient<R>(R body(), Client clientFactory(), {ZoneSpecification? zoneSpecification}) → R
Runs body in its own Zone with the Client returned by clientFactory set as the default Client.
sendHttpRequest(String requestId, APIType apiType, HttpRequestModel requestModel, {SupportedUriSchemes defaultUriScheme = kDefaultUriScheme, bool noSSL = false}) Future<(HttpResponse?, Duration?, String?)>
sendHttpRequestV1(String requestId, APIType apiType, HttpRequestModel requestModel, {SupportedUriSchemes defaultUriScheme = kDefaultUriScheme, bool noSSL = false}) Future<(HttpResponse?, Duration?, String?)>
shuffle(List elements, [int start = 0, int? end, Random? random]) → void
Shuffles a list randomly.
streamHttpRequest(String requestId, APIType apiType, HttpRequestModel httpRequestModel, {SupportedUriSchemes defaultUriScheme = kDefaultUriScheme, bool noSSL = false}) Future<Stream<HttpStreamOutput?>>
stripUriParams(Uri uri) String
stripUrlParams(String url) String
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.

Exceptions / Errors

ClientException
An exception caused by an error in a pkg/http client.
RequestAbortedException
Thrown when an HTTP request is aborted.