code_id_network library Null safety
Classes
- AuthInterceptor
- BaseOptions
-
The common config for the Dio instance.
dio.options
is a instance of BaseOptions - CancelToken
- You can cancel a request by using a cancel token. One token can be shared with different requests. when a token's cancel method invoked, all requests with this token will be cancelled.
- DefaultTransformer
- Dio
- A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, File downloading etc. and Dio is very easy to use.
- DioMixin
- ErrorInterceptorHandler
- Handler for error interceptor.
- FormData
- A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
- Headers
- HttpClientAdapter
- HttpAdapter is a bridge between Dio and HttpClient.
- INetworkService
-
InMemoryStorage<
T> - Interceptor
-
Dio instance may have interceptor(s) by which you can intercept
requests/responses/errors before they are handled by
then
orcatchError
. See also: - Interceptors
- Interceptors are a queue, and you can add any number of interceptors, All interceptors will be executed in first in first out order.
- InterceptorsWrapper
- InterceptorsWrapper is a helper class, which is used to conveniently create interceptor(s). See also:
-
ListParam<
T> - Lock
- Add lock/unlock API for interceptors.
- LoggerInterceptor
- LogInterceptor
- LogInterceptor is used to print logs during network requests. It's better to add LogInterceptor to the tail of the interceptor queue, otherwise the changes made in the interceptor behind A will not be printed out. 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. - NetworkError
- NetworkOptions
- NetworkService
- Options
- Every request can pass an Options object which will be merged with Dio.options
- QueuedInterceptor
- Serialize the request/response/error before they enter the interceptor.
- QueuedInterceptorsWrapper
- QueuedInterceptorsWrapper is a helper class, which is used to conveniently create QueuedInterceptor(s). See also:
- RedirectRecord
- RequestInterceptorHandler
- Handler for request interceptor.
- RequestOptions
-
Response<
T> - Response describes the http Response info.
- ResponseBody
- ResponseInterceptorHandler
- Handler for response interceptor.
-
TokenStorage<
T> - Transformer
- Transformer allows changes to the request/response data before it is sent/received to/from the server.
Mixins
Constants
-
retryableStatuses
→ const Set<
int> -
<int>{status408RequestTimeout, status429TooManyRequests, status500InternalServerError, status502BadGateway, status503ServiceUnavailable, status504GatewayTimeout, status440LoginTimeout, status499…
- status100Continue → const int
-
100
- status101SwitchingProtocols → const int
-
101
- status102Processing → const int
-
102
- status200OK → const int
-
200
- status201Created → const int
-
201
- status202Accepted → const int
-
202
- status203NonAuthoritative → const int
-
203
- status204NoContent → const int
-
204
- status205ResetContent → const int
-
205
- status206PartialContent → const int
-
206
- status207Multistatus → const int
-
207
- status208AlreadyReported → const int
-
208
- status226IMUsed → const int
-
226
- status300MultipleChoices → const int
-
300
- status301MovedPermanently → const int
-
301
- status302Found → const int
-
302
- status303SeeOther → const int
-
303
- status304NotModified → const int
-
304
- status305UseProxy → const int
-
305
- status306SwitchProxy → const int
-
306
- status307TemporaryRedirect → const int
-
307
- status308PermanentRedirect → const int
-
308
- status400BadRequest → const int
-
400
-
401
- status402PaymentRequired → const int
-
402
- status403Forbidden → const int
-
403
- status404NotFound → const int
-
404
- status405MethodNotAllowed → const int
-
405
- status406NotAcceptable → const int
-
406
- status407ProxyAuthenticationRequired → const int
-
407
- status408RequestTimeout → const int
-
408
- status409Conflict → const int
-
409
- status410Gone → const int
-
410
- status411LengthRequired → const int
-
411
- status412PreconditionFailed → const int
-
412
- status413PayloadTooLarge → const int
-
413
- status413RequestEntityTooLarge → const int
-
413
- status414RequestUriTooLong → const int
-
414
- status414UriTooLong → const int
-
414
- status415UnsupportedMediaType → const int
-
415
- status416RangeNotSatisfiable → const int
-
416
- status416RequestedRangeNotSatisfiable → const int
-
416
- status417ExpectationFailed → const int
-
417
- status418ImATeapot → const int
-
418
- status419AuthenticationTimeout → const int
-
419
- status421MisdirectedRequest → const int
-
421
- status422UnprocessableEntity → const int
-
422
- status423Locked → const int
-
423
- status424FailedDependency → const int
-
424
- status426UpgradeRequired → const int
-
426
- status428PreconditionRequired → const int
-
428
- status429TooManyRequests → const int
-
429
- status431RequestHeaderFieldsTooLarge → const int
-
431
- status440LoginTimeout → const int
-
From IIS
440
-
451
- status460ClientClosedRequest → const int
-
From AWS Elastic Load Balancer
460
- status499ClientClosedRequest → const int
-
From ngnix
499
- status500InternalServerError → const int
-
500
- status501NotImplemented → const int
-
501
- status502BadGateway → const int
-
502
-
503
- status504GatewayTimeout → const int
-
504
- status505HttpVersionNotSupported → const int
-
505
- status506VariantAlsoNegotiates → const int
-
506
- status507InsufficientStorage → const int
-
507
- status508LoopDetected → const int
-
508
- status510NotExtended → const int
-
510
- status511NetworkAuthenticationRequired → const int
-
511
- status520WebServerReturnedUnknownError → const int
-
520
- status521WebServerIsDown → const int
-
521
- status522ConnectionTimedOut → const int
-
522
- status523OriginIsUnreachable → const int
-
523
- status524TimeoutOccurred → const int
-
524
- status525SSLHandshakeFailed → const int
-
525
- status526InvalidSSLCertificate → const int
-
526
- status527RailgunError → const int
-
527
- status598NetworkReadTimeoutError → const int
-
598
- status599NetworkConnectTimeoutError → const int
-
599
Functions
-
isRetryable(
int statusCode) → bool
Enums
- AuthenticationStatus
- Enum representing the current authentication status of the application.
- DioErrorType
- ListFormat
- 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
- ResponseType indicates which transformation should be automatically applied to the response data by Dio.
Typedefs
-
AuthTokenBuilder
= Map<
String, dynamic> ? Function(dynamic token) -
HeaderForEachCallback
= void Function(String name, List<
String> values) - InterceptorErrorCallback = void Function(DioError e, ErrorInterceptorHandler handler)
- InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
- InterceptorSuccessCallback = void Function(Response e, ResponseInterceptorHandler handler)
- JsonDecodeCallback = dynamic Function(String)
- The default Transformer for Dio. If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the DefaultTransformer by setting the dio.Transformer.
- ProgressCallback = void Function(int count, int total)
- Callback to listen the progress for sending/receiving data.
-
RequestEncoder
= List<
int> Function(String request, RequestOptions options) -
ResponseDecoder
= String Function(List<
int> responseBytes, RequestOptions options, ResponseBody responseBody) -
RetryEvaluator
= FutureOr<
bool> Function(DioError error, int attempt) - ValidateStatus = bool Function(int? status)
Exceptions / Errors
- DioError
- DioError describes the error info when request failed.
- RevokeTokenException