get<T> method

Future<BaseModel> get<T>(
  1. String path, {
  2. dynamic tag,
  3. Map<String, dynamic>? params,
  4. Object? data,
  5. bool? loading,
  6. Options? options,
  7. CancelToken? cancelToken,
})

Implementation

Future<BaseModel> get<T>(
  String path, {
  dynamic tag,
  Map<String, dynamic>? params,
  Object? data,
  bool? loading,
  Options? options,
  CancelToken? cancelToken,
}) async {
  assert(_singleton != null, '请先调用 initialize');
  if (hasNetWork) return notNetWorkModel;
  _addLoading(loading);
  final res = await dio.get<T>(path,
      data: data,
      options: _mergeOptions(options, path),
      cancelToken: cancelToken,
      params: baseDioOptions.extraParams?.call(path, params) ?? params);
  return _response(res, tag);
}