# dio-repository **Repository Path**: flutter-package/dio-repository ## Basic Information - **Project Name**: dio-repository - **Description**: 简单封装dio网络请求库 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-08-09 - **Last Updated**: 2022-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 封装dio库 为了更好的使用对dio网络库进行二次封装 ### 安装使用 ``` dependencies: dio_repository: ^1.1.1 ``` ### 主项目中引入 ```dart 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 ); ``` ### 网络库模块使用 ```dart dynamic data = await DSDioUtil.getInstance().get('/xxxx',queryParameters:{'key':'value'}); ```