dio_repository 1.1.2 copy "dio_repository: ^1.1.2" to clipboard
dio_repository: ^1.1.2 copied to clipboard

dio基础网络库封装.

封装dio库 #

为了更好的使用对dio网络库进行二次封装

安装使用 #

dependencies:
  dio_repository: ^1.1.2

主项目中引入 #

DSHttpInject httpInject = DSHttpInject(
    onRequest:(options,handler){
        //做请求的拦截处理
      handler.next(options);
    },onResponse:(options,handler){
        //做响应的拦截处理
      handler.next(options);
    },onError:(options,handler){
        //异常错误处理
      handler.next(options);
    },
  );

  DSDioUtil.getInstance().init(
    baseUrl: 'xxx',
    connectTimeout: 2000,
    inject:httpInject
  );

网络库模块使用 #

dynamic data = await DSDioUtil.getInstance().get('/xxxx',queryParameters:{'key':'value'});
0
likes
85
pub points
0%
popularity

Publisher

verified publisherdsfgx.com

dio基础网络库封装.

Homepage
Repository

Documentation

API reference

License

MIT (LICENSE)

Dependencies

dio, flutter

More

Packages that depend on dio_repository