mx_http library
Support for doing something awesome.
More dartdocs go here.
Classes
- Api
- 宣告一個 abstract class 是個 api 請求的 interface
- 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. - Body
- 宣告 method 裡面的參數為 body
- CancelToken
- Controls cancellation of Dio's requests.
- Delete
- 宣告 method 為 delete 方法
- Dio
- Dio enables you to make HTTP requests easily.
- DioMixin
- Download
- 宣告 method 為 download 方法
- ErrorInterceptorHandler
- The handler for interceptors to handle error occurred during the request.
- 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
- Get
- 各個 method 的 path 皆可帶入變數 示例 @Get('path1/path2/{變數名稱}') HttpContent(@Path('變數名稱') String pathVar) 宣告 method 為 get 方法 path 可帶入變數, 宣告方式為
- Header
- 宣告 method 裡面的參數為 header
- Headers
- The headers class for requests and responses.
- HttpClientAdapter
-
HttpAdapter
is a bridge between Dio and HttpClient. - HttpContent
- http的請求body, 對於 HttpUtils 的接口封裝
- HttpContentGenerator
- HttpContent產生器, 主要在於可以設置預設header/param
- HttpContentMixin
- HttpContentType
- HttpUtil
- 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.
-
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. - Options
- The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
- Param
- 宣告 method 裡面的參數為 queryParam
- Path
- 宣告 method 裡面的參數為 path 裡面的變數
- Post
- 宣告 method 為 post 方法
- Put
- 宣告 method 為 put 方法
- QueuedInterceptor
- Interceptor in queue.
- QueuedInterceptorsWrapper
- A helper class to create queued-interceptors in ease.
- RedirectRecord
- A record that records the redirection happens during requests, including status code, request method, and the location.
- RequestBuilderBase
- 子httpContent的建構類
- 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.
-
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.
- ServerResponse
- 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.
- Transformer
- Transformer allows changes to the request/response data before it is sent/received to/from the server.
Enums
- DioExceptionType
- The exception enumeration indicates what type of exception has happened during requests.
- HttpBodyType
- HttpErrorType
- 直接從 dio 轉為自己的錯誤訊息
- HttpMethod
- 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.
Typedefs
- 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)
-
RequestEncoder
= FutureOr<
List< Function(String request, RequestOptions options)int> > - 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.
- ValidateStatus = bool Function(int? status)
- The type of a response status code validate callback.
Exceptions / Errors
- DioException
- DioException describes the exception info when a request failed.
- HttpError
-
NotNullableError<
T> -
A TypeError thrown by
_checkNotNullable
.