dio_builder library

Classes

BackgroundTransformer
The default Transformer for Dio.
BaseOptions
A set of base settings for each Dio(). BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
BytesBuilder
Builds a list of bytes, allowing bytes and lists of bytes to be added at the end.
CancelToken
Controls cancellation of Dio's requests.
ChuckerChopperInterceptor
ChuckerChopperInterceptor adds support for chucker_flutter in Chopper
ChuckerDioInterceptor
ChuckerDioInterceptor adds support for chucker_flutter in Dio library.
ChuckerFlutter
ChuckerFlutter is a helper class to initialize the library
ChuckerHttpClient
Chucker Flutter's wrapper for http library
ChuckerHttpLoggingInterceptor
Logs http request and response data
CompressionOptions
Options controlling compression in a WebSocket.
ConnectionTask<S>
A cancelable connection attempt.
ContentType
A MIME/IANA media type used as the value of the HttpHeaders.contentTypeHeader header.
Representation of a cookie. For cookies received by the server as Cookie header values only name and value properties will be set. When building a cookie for the 'set-cookie' header in the server and when receiving cookies in the client as 'set-cookie' headers all fields can be used.
Datagram
A data packet received by a RawDatagramSocket.
DefaultRetryEvaluator
Dio
Dio enables you to make HTTP requests easily.
DioBuilder
The DioBuilder class provides a builder pattern for configuring and creating instances of the Dio HTTP client. It abstracts common configurations and interceptors for making HTTP requests.
DioMixin
Directory
A reference to a directory (or folder) on the file system.
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
File
A reference to a file on the file system.
FileLock
Type of lock when requesting a lock on a file.
FileMode
The modes in which a File can be opened.
FileStat
The result of calling the POSIX stat() function on a file system object.
FileSystemCreateEvent
File system event for newly created file system objects.
FileSystemDeleteEvent
File system event for deletion of file system objects.
FileSystemEntity
The common superclass of File, Directory, and Link.
FileSystemEntityType
The type of an entity on the file system, such as a file, directory, or link.
FileSystemEvent
Base event class emitted by FileSystemEntity.watch.
FileSystemModifyEvent
File system event for modifications of file system objects.
FileSystemMoveEvent
File system event for moving of file system objects.
FilterArgs
Filter arguments
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
FusedTransformer
A Transformer that has a fast path for decoding UTF8-encoded JSON. If the response is utf8-encoded JSON and no custom decoder is specified in the RequestOptions, this transformer is significantly faster than the default SyncTransformer and the BackgroundTransformer. This improvement is achieved by using a fused Utf8Decoder and JsonDecoder to decode the response, which is faster than decoding the utf8-encoded JSON in two separate steps, since Dart uses a special fast decoder for this case. See https://github.com/dart-lang/sdk/blob/5b2ea0c7a227d91c691d2ff8cbbeb5f7f86afdb9/sdk/lib/_internal/vm/lib/convert_patch.dart#L40
GZipCodec
The GZipCodec encodes raw bytes to GZip compressed bytes and decodes GZip compressed bytes to raw bytes.
Headers
The headers class for requests and responses.
HeaderValue
Representation of a header value in the form:
HttpClient
An HTTP client for communicating with an HTTP server.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
HttpClientBasicCredentials
Represents credentials for basic authentication.
HttpClientCredentials
HttpClientDigestCredentials
Represents credentials for digest authentication. Digest authentication is only supported for servers using the MD5 algorithm and quality of protection (qop) of either "none" or "auth".
HttpClientRequest
HTTP request for a client connection.
HttpClientResponse
HTTP response for a client connection.
HttpConnectionInfo
Information about an HttpRequest, HttpResponse, HttpClientRequest, or HttpClientResponse connection.
HttpConnectionsInfo
Summary statistics about an HttpServers current socket connections.
HttpDate
Utility functions for working with dates with HTTP specific date formats.
HttpHeaders
Headers for HTTP requests and responses.
HttpOverrides
This class facilitates overriding HttpClient with a mock implementation. It should be extended by another class in client code with overrides that construct a mock implementation. The implementation in this base class defaults to the actual HttpClient implementation. For example:
HttpRequest
A server-side object that contains the content of and information about an HTTP request.
HttpResponse
An HTTP response, which returns the headers and data from the server to the client in response to an HTTP request.
HttpServer
A server that delivers content, such as web pages, using the HTTP protocol.
HttpSession
The HttpRequest.session of an HttpRequest.
HttpStatus
HTTP status codes. Exported in dart:io and dart:html.
Interceptor
Interceptor helps to deal with RequestOptions, Response, and DioException during the lifecycle of a request before it reaches users.
Interceptors
A Queue-Model list for Interceptors.
InterceptorsWrapper
A helper class to create interceptors in ease.
InternetAddress
An internet address or a Unix domain address.
InternetAddressType
The type, or address family, of an InternetAddress.
IOOverrides
Facilities for overriding various APIs of dart:io with mock implementations.
IOSink
A combined byte and text output.
References to filesystem links.
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
LogInterceptor
LogInterceptor is used to print logs during network requests. It should be the last interceptor added, otherwise modifications by following interceptors will not be logged. This is because the execution of interceptors is in the order of addition.
MultipartFile
A file to be uploaded as part of a MultipartRequest. This doesn't need to correspond to a physical file.
MultipartFileRecreatable
Creates an instance of MultipartFile that can be recreated and reused.
NetworkInterface
A NetworkInterface represents an active network interface on the current system. It contains a list of InternetAddresses that are bound to the interface.
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
Pipe
An anonymous pipe that can be used to send data in a single direction i.e. data written to write can be read using read.
Platform
Information about the environment in which the current program is running.
PrettyDioLogger
A pretty logger for Dio it will print request/response info with a pretty format and also can filter the request/response by RequestOptions
Process
The means to execute a program.
ProcessInfo
Methods for retrieving information about the current process.
ProcessResult
The result of running a non-interactive process started with Process.run or Process.runSync.
ProcessSignal
On Posix systems, ProcessSignal is used to send a specific signal to a child process, see Process.kill.
ProcessStartMode
Modes for running a new process.
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create queued-interceptors in ease.
RandomAccessFile
Random access to the data in a file.
RawDatagramSocket
An unbuffered interface to a UDP socket.
RawSecureServerSocket
A server socket providing a stream of low-level RawSecureSockets.
RawSecureSocket
RawSecureSocket provides a secure (SSL or TLS) network connection.
RawServerSocket
A listening socket.
RawSocket
A TCP connection.
RawSocketEvent
Events for the RawDatagramSocket, RawSecureSocket, and RawSocket.
RawSocketOption
The RawSocketOption is used as a parameter to Socket.setRawOption and RawSocket.setRawOption to customize the behaviour of the underlying socket.
RawSynchronousSocket
A low-level class for communicating synchronously over a TCP socket.
RawZLibFilter
The RawZLibFilter class provides a low-level interface to zlib.
ReadPipe
The "read" end of an Pipe created by Pipe.create.
RedirectInfo
Redirect information.
RedirectRecord
A record that records the redirection happens during requests, including status code, request method, and the location.
RequestInterceptorHandler
The handler for interceptors to handle before the request has been sent.
RequestOptions
The internal request option class that is the eventual result after BaseOptions and Options are composed.
ResourceHandle
A wrapper around OS resource handle so it can be passed via Socket as part of SocketMessage.
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.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
RetryInterceptor
An interceptor that will try to send failed request again
SameSite
Cookie cross-site availability configuration.
SecureServerSocket
A server socket, providing a stream of high-level Sockets.
SecureSocket
A TCP socket using TLS and SSL.
SecurityContext
The object containing the certificates to trust when making a secure client connection, and the certificate chain and private key to serve from a secure server.
ServerSocket
A listening socket.
Socket
A TCP connection between two sockets.
SocketControlMessage
Control message part of the SocketMessage received by a call to RawSocket.readMessage.
SocketDirection
The SocketDirection is used as a parameter to Socket.close and RawSocket.close to close a socket in the specified direction(s).
SocketMessage
A socket message received by a RawDatagramSocket.
SocketOption
An option for a socket which is configured using Socket.setOption.
Stdin
The standard input stream of the process.
StdioType
The type of object a standard IO stream can be attached to.
Stdout
An IOSink connected to either the standard out or error of the process.
SyncTransformer
If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the transformer by setting the Dio.transformer.
SystemEncoding
The system encoding is the current code page on Windows and UTF-8 on Linux and Mac.
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.
WebSocket
A two-way HTTP communication object for client or server applications.
WebSocketStatus
WebSocket status codes used when closing a WebSocket connection.
WebSocketTransformer
The WebSocketTransformer provides the ability to upgrade a HttpRequest to a WebSocket connection. It supports both upgrading a single HttpRequest and upgrading a stream of HttpRequests.
WritePipe
The "write" end of an Pipe created by Pipe.create.
X509Certificate
X509Certificate represents an SSL certificate, with accessors to get the fields of the certificate.
ZLibCodec
The ZLibCodec encodes raw bytes to ZLib compressed bytes and decodes ZLib compressed bytes to raw bytes.
ZLibDecoder
The ZLibDecoder is used by ZLibCodec and GZipCodec to decompress data.
ZLibEncoder
The ZLibEncoder encoder is used by ZLibCodec and GZipCodec to compress data.
ZLibOption
Exposes ZLib options for input parameters.

Enums

DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
HttpClientResponseCompressionState
Enum that specifies the compression state of the byte stream of an HttpClientResponse.
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
ResponseType
Indicates which transformation should be applied to the response data.

Mixins

OptionsMixin
The mixin class for options that provides common attributes.

Constants

defaultRetryableStatuses → const Set<int>
gzip → const GZipCodec
An instance of the default implementation of the GZipCodec.
retryableStatuses → const Set<int>
status100Continue → const int
status101SwitchingProtocols → const int
status102Processing → const int
status200OK → const int
status201Created → const int
status202Accepted → const int
status203NonAuthoritative → const int
status204NoContent → const int
status205ResetContent → const int
status206PartialContent → const int
status207Multistatus → const int
status208AlreadyReported → const int
status226IMUsed → const int
status300MultipleChoices → const int
status301MovedPermanently → const int
status302Found → const int
status303SeeOther → const int
status304NotModified → const int
status305UseProxy → const int
status306SwitchProxy → const int
status307TemporaryRedirect → const int
status308PermanentRedirect → const int
status400BadRequest → const int
status401Unauthorized → const int
status402PaymentRequired → const int
status403Forbidden → const int
status404NotFound → const int
status405MethodNotAllowed → const int
status406NotAcceptable → const int
status407ProxyAuthenticationRequired → const int
status408RequestTimeout → const int
status409Conflict → const int
status410Gone → const int
status411LengthRequired → const int
status412PreconditionFailed → const int
status413PayloadTooLarge → const int
status413RequestEntityTooLarge → const int
status414RequestUriTooLong → const int
status414UriTooLong → const int
status415UnsupportedMediaType → const int
status416RangeNotSatisfiable → const int
status416RequestedRangeNotSatisfiable → const int
status417ExpectationFailed → const int
status418ImATeapot → const int
status419AuthenticationTimeout → const int
status421MisdirectedRequest → const int
status422UnprocessableEntity → const int
status423Locked → const int
status424FailedDependency → const int
status426UpgradeRequired → const int
status428PreconditionRequired → const int
status429TooManyRequests → const int
status431RequestHeaderFieldsTooLarge → const int
status440LoginTimeout → const int
From IIS
status451UnavailableForLegalReasons → const int
status460ClientClosedRequest → const int
From AWS Elastic Load Balancer
status499ClientClosedRequest → const int
From ngnix
status500InternalServerError → const int
status501NotImplemented → const int
status502BadGateway → const int
status503ServiceUnavailable → const int
status504GatewayTimeout → const int
status505HttpVersionNotSupported → const int
status506VariantAlsoNegotiates → const int
status507InsufficientStorage → const int
status508LoopDetected → const int
status510NotExtended → const int
status511NetworkAuthenticationRequired → const int
status520WebServerReturnedUnknownError → const int
status521WebServerIsDown → const int
status522ConnectionTimedOut → const int
status523OriginIsUnreachable → const int
status524TimeoutOccurred → const int
status525SSLHandshakeFailed → const int
status526InvalidSSLCertificate → const int
status527RailgunError → const int
status598NetworkReadTimeoutError → const int
status599NetworkConnectTimeoutError → const int
systemEncoding → const SystemEncoding
The current system encoding.
zlib → const ZLibCodec
An instance of the default implementation of the ZLibCodec.

Properties

exitCode int
Get the global exit code for the Dart VM.
getter/setter pair
pid int
Returns the PID of the current process.
no setter
statusCodes Map<int, String>
Common http status codes
final
stderr Stdout
The standard output stream of errors written by this program.
no setter
stdin Stdin
The standard input stream of data read by this program.
no setter
stdout Stdout
The standard output stream of data written by this program.
no setter

Functions

delete({required String endPoint, required Map<String, dynamic> data, CancelToken? cancelToken}) Future<Response>
Performs a delete request to the specified endpoint.
exit(int code) → Never
Exit the Dart VM process immediately with the given exit code.
get({required String endPoint, CancelToken? cancelToken, dynamic onReceiveProgress(int count, int total)?}) Future<Response>
Performs a get request to the specified endpoint.
Performs a head request to the specified endpoint.
isRetryable(int statusCode) bool
Be careful: this method do not take into account RetryInterceptor.retryableExtraStatuses
patch({required String endPoint, required Map<String, dynamic> data, CancelToken? cancelToken, dynamic onSendProgress(int count, int total)?, dynamic onReceiveProgress(int count, int total)?}) Future<Response>
Performs a patch request to the specified endpoint.
post({required String endPoint, required Map<String, dynamic> data, CancelToken? cancelToken, dynamic onSendProgress(int count, int total)?, dynamic onReceiveProgress(int count, int total)?}) Future<Response>
Performs a POST request to the specified endpoint.
put({required String endPoint, required Map<String, dynamic> data, CancelToken? cancelToken, dynamic onSendProgress(int count, int total)?, dynamic onReceiveProgress(int count, int total)?}) Future<Response>
Performs a put request to the specified endpoint.
request({required String endPoint, required Map<String, dynamic> data, CancelToken? cancelToken, dynamic onSendProgress(int count, int total)?, dynamic onReceiveProgress(int count, int total)?}) Future<Response>
Performs a head request to the specified endpoint.
sleep(Duration duration) → void
Sleep for the duration specified in duration.
stdioType(dynamic object) StdioType
Whether a stream is attached to a file, pipe, terminal, or something else.

Typedefs

BadCertificateCallback = bool Function(X509Certificate cr, String host, int port)
DefaultTransformer = SyncTransformer
DioError = DioException
DioError describes the exception info when a request failed.
DioErrorType = DioExceptionType
Deprecated in favor of DioExceptionType and will be removed in future major versions.
DioMediaType = MediaType
The type (alias) for specifying the content-type of the MultipartFile.
HeaderForEachCallback = void Function(String name, List<String> values)
The signature that iterates header fields.
InterceptorErrorCallback = void Function(DioException error, ErrorInterceptorHandler handler)
The signature of Interceptor.onError.
InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
The signature of Interceptor.onRequest.
InterceptorSuccessCallback = void Function(Response response, ResponseInterceptorHandler handler)
The signature of Interceptor.onResponse.
JsonDecodeCallback = FutureOr Function(String)
The callback definition for decoding a JSON string.
JsonEncodeCallback = FutureOr<String> Function(Object)
The callback definition for encoding a JSON object.
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
RequestEncoder = FutureOr<List<int>> Function(String request, RequestOptions options)
The type of a request encoding callback.
ResponseDecoder = FutureOr<String?> Function(List<int> responseBytes, RequestOptions options, ResponseBody responseBody)
The type of a response decoding callback.
RetryEvaluator = FutureOr<bool> Function(DioException error, int attempt)
T = dynamic
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

CertificateException
An exception that happens in the handshake phase of establishing a secure network connection, when looking up or verifying a certificate.
DioException
DioException describes the exception info when a request failed.
FileSystemException
Exception thrown when a file operation fails.
HandshakeException
An exception that happens in the handshake phase of establishing a secure network connection.
HttpException
IOException
Base class for all IO related exceptions.
NotNullableError<T>
A TypeError thrown by _checkNotNullable.
OSError
An Exception holding information about an error from the operating system.
PathAccessException
Exception thrown when a file operation fails because the necessary access rights are not available.
PathExistsException
Exception thrown when a file operation fails because the target path already exists.
PathNotFoundException
Exception thrown when a file operation fails because a file or directory does not exist.
ProcessException
RedirectException
SignalException
SocketException
Exception thrown when a socket operation fails.
StdinException
Exception thrown by some operations of Stdin
StdoutException
Exception thrown by some operations of Stdout
TlsException
A secure networking exception caused by a failure in the TLS/SSL protocol.
WebSocketException