RequestUtil class
Constructors
- RequestUtil({required String baseUrl, required String path, required RequestMethod method, required RequestParams? params, required RequestSuccess success, required RequestError error, RequestHeaders? headers, RequestInterceptors? interceptors})
-
初始化
baseUrl
请求域名/ippath
url地址method
请求方法params
发起请求的param参数success
成功回调error
失败回调headers
单独设置的请求头interceptors
自定义拦截器
Properties
- baseUrl ↔ String
-
getter/setter pair
- dio ↔ Dio
-
latefinal
- error ↔ RequestError
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- method ↔ RequestMethod
-
getter/setter pair
- params ↔ RequestParams?
-
getter/setter pair
- path ↔ String
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- success ↔ RequestSuccess
-
getter/setter pair
Methods
-
get(
{required CancelToken cancelToken}) → Future< void> -
发起get请求
params 发起请求的param参数
cancelToken
取消请求的cancelToken -
getAuthorizationHeader(
) → Map< String, dynamic> ? - 添加单独认证
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post(
{required CancelToken cancelToken}) → Future< void> -
发起get请求
cancelToken
取消请求的cancelToken -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kConnectTimeout → const int
- kReceiveTimeout → const int