BaseApi<T> class
abstract
- Inheritance
-
- Object
- HandleLoading
- BaseApi
- Mixed-in types
- Implementers
Constructors
-
BaseApi(dynamic path, {dynamic param, Options? opt, String method = 'POST', Map<
String, dynamic> ? queryParameters, bool isDebug = true, CancelToken? cancelToken, TransformJson<T> ? serializer, bool showLoading = true, bool dismissLoading = true, bool showToast = true, bool encrypt = false, bool cache = false, bool showLog = true})
Properties
- baseUrl ↔ String
-
getter/setter pair
- cache ↔ bool
-
是否使用缓存, get / post 都会使用缓存
getter/setter pair
- cancelToken → CancelToken?
-
final
- dismissLoading ↔ bool
-
dismiss loading or not when network response
getter/setter pair
- encrypt ↔ bool
-
encrypt or not , if true you need imp HandleEncrypt
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDebug ↔ bool
-
print log or not
getter/setter pair
- loadingMsg ↔ String
-
getter/setter pairinherited
- method ↔ String
-
getter/setter pair
- opt ↔ Options?
-
getter/setter pair
- param ↔ dynamic
-
getter/setter pair
- path → dynamic
-
支持 string 或者 uri
final
-
queryParameters
↔ Map<
String, dynamic> ? -
getter/setter pair
-
result
↔ BaseModel<
T> -
BaseModel witch is transfrom by response data
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
serializer
↔ TransformJson<
T> ? -
根据 BaseModel.result 内省结果, 完成相应的模型转换
getter/setter pair
- showLoading ↔ bool
-
show loading or not when request will beginning
getter/setter pair
- showLog ↔ bool
-
show log or not
getter/setter pair
- showToast ↔ bool
-
show toast or not when response error
getter/setter pair
Methods
-
close(
{bool force = false}) → dynamic -
custom(
) → Future< Response> -
dispatch(
) → Future< BaseModel< T> > - 约定: dispatch().then 代表 网络&业务逻辑 都是成功
-
getUrl(
) → dynamic -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDimiss(
) → void -
inherited
-
onShowLoading(
) → void -
inherited
-
onShowToast(
{String msg = '加载失败'}) → void -
inherited
-
serializerJson(
) → void - 模型解析
-
toString(
) → String -
A string representation of this object.
inherited
-
transformModelFromResponseData<
T> (Map responseData) → BaseModel< T> -
解析请求结果
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited