pf_dart_http 1.0.0 copy "pf_dart_http: ^1.0.0" to clipboard
pf_dart_http: ^1.0.0 copied to clipboard

Problem Fighter make a library for HTTP Request, Which is basically use of Dart HTTP package. The object of this library is use the dart http library with easy way with all combination such as POST, G [...]

Problem Fighter Dart HTTP Request Library #

Simple Print Method #

void printResponse(PFHttpResponse response){
  print('\n\n');
  print('Response status: ${response.statusCode}');
  print('Response body: ${response.body}');
}

POST Request #

var baseURL = "https://flask-hmtmcse.herokuapp.com/";
var data = {
  "description": "postJsonRequest",
  "name": "postJsonRequest",
  "target": "postJsonRequest",
  "targetType": "postJsonRequest",
  "title": "postJsonRequest",
  "type": "TextOnly"
};

var response = await PFDartHTTP.instance().POSTRequest(baseURL + "api/v1/card/form-data", data: data);
printResponse(response);

JSON POST Request #

var baseURL = "https://flask-hmtmcse.herokuapp.com/";
var jsonCreate = {
  'data': {
    "description": "postJsonRequest",
    "name": "postJsonRequest",
    "target": "postJsonRequest",
    "targetType": "postJsonRequest",
    "title": "postJsonRequest",
    "type": "TextOnly"
  }
};

var response = await PFDartHTTP.instance().jsonPOSTRequest(baseURL + "api/v1/card/create", data: jsonCreate);
printResponse(response);

Simple Get Request #

var baseURL = "https://flask-hmtmcse.herokuapp.com/";
var response = await PFDartHTTP.instance().GETRequest(baseURL + "api/v1/card/list");
printResponse(response);

POST upload file Request #

var baseURL = "https://flask-hmtmcse.herokuapp.com/";
var file = File("C:\\Users\\hmtmc\\Desktop\\gm\\consumer\\8.order-list.jpeg");
var uploadFileMap = {
  "name": file
};
var response = await PFDartHTTP.instance().uploadRequest(baseURL + "api/v1/card/upload-file", uploadFileMap);
printResponse(response);
3
likes
100
points
19
downloads

Publisher

verified publisherproblemfighter.com

Weekly Downloads

Problem Fighter make a library for HTTP Request, Which is basically use of Dart HTTP package. The object of this library is use the dart http library with easy way with all combination such as POST, GET, PUT, DELETE, File upload etc, you may use the single file codes directly, without include this library.

Repository (GitHub)

Documentation

Documentation
API reference

License

Apache-2.0 (license)

Dependencies

http

More

Packages that depend on pf_dart_http