dio 0.0.1 copy "dio: ^0.0.1" to clipboard
dio: ^0.0.1 copied to clipboard

outdated

A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData and soon on.

example/dio.dart

import 'dart:async';
import 'dart:io';
import 'package:dio/dio.dart';

main() async {
  var dio = new Dio();
  dio.options.baseUrl = "http://www.dtworkroom.com/doris/1/2.0.0/";
  dio.options.headers = {
    'XX': '8'
  };

//  dio.httpClient.findProxy = (uri) {
//    //proxy all request to localhost:8888
//    return "PROXY localhost:8888";
//  };

  dio.interceptor.request.onSend = (Options options) async {
    // return ds.resolve(new Response(data:"xxx"));
    // return ds.reject(new Err(message: "eh"));
    return options;
  };


  Response<String> response= await dio.get("https://www.google.com/");
  print(response.data);

  response=await dio.download("https://www.google.com/","./xx.html",onProgress: (received,total){
    print('$received,$total');
  });

//  ds.get("/test",data:{'aa':8}).catchError((Err err){
//    print(err);
//  });

  print(response);

  //FormData.boundary = "----------------------------272264345542536768869165";
  FormData formData = new FormData.from({
    "name": "wendux /r/n xxx \r\n   \$%#@ ",
    "age": 25,
    "file": new UploadFileInfo(new File("./example/upload.txt"), "upload.txt")
  });
//
//  response = await dio.post("/token", data: formData);
//  print(response);

  //Response response= await ds.post("/test",data:formData);
  //print(response.toString());

  //new Timer(new Duration(seconds: 2),()=>ds.unlock());
  //Response response= await ds.get("/test",data:{'aa':8});
  //print(response.data);

}
7574
likes
0
pub points
100%
popularity

Publisher

verified publisherflutter.cn

A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData and soon on.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on dio