v0.0.4+1
dio_interceptors
为 Dio 包的使用实现拦截器。
14喜欢 14近 30 天下载30Pub 分数
平台暂无数据
gabuldev/dio_interceptors open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
A interceptors to use on Dio.
You use for mock API requests.
void main() {
Dio dio = Dio();
var mockData = {
"/test" : {
"name" : "Gabul DEV",
"site" : "https://gabul.dev"
}
};
dio.interceptors.add(InterceptorMock(mockData));
void getData() async{
var res = await dio.get("/test");
print(res.data["name"])// "Gabul DEV"
print(res.data["site"])// "https://gabul.dev");
}
getData();
}
You can use for add JWT all requests
Future<String> token() async{
//Implements your logic here
return jwt;
}
dio.interceptors.add(InterceptorToken(token: () async => await token()))
依赖清单 3 项
^4.0.0-beta2{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗