webservice 0.0.4 webservice: ^0.0.4 copied to clipboard
A powerful Http client for Dart, which handles requests. Super easy to use and much more comming soon. Wait for our updates.
WebService #
A powerful Http client for Dart, which handles requests.
Get started #
Add dependency #
dependencies:
webservice: ^0.0.4
Super simple to use #
import 'package:webservice/webservice.dart';
getData(){
WebService().get(url: "enter your url", onResponse: (response){
print('${response.statusCode} ${response.message} ${response.data}');
});
}
Setting base url or custom headers #
import 'package:webservice/webservice.dart';
getData(){
WebService webService = WebService();
webService.baseURL="your base url";
Map headers={
"Accept": "application/json",
"Content-Type": "application/json",
};
webService.get(url: "enter your sub url",headers: headers, onResponse: (response){
print('${response.statusCode} ${response.message} ${response.data}');
});
}
///this is a post method
post() {
WebService().post(url: "enter your url",body: {"id":"1"}, onResponse: (response){
print('${response.statusCode} ${response.message} ${response.data}');
});
}
///this is a put method
put(String filter) {
WebService().put(url: "enter your url",body: {"id":"1"}, onResponse: (response){
print('${response.statusCode} ${response.message} ${response.data}');
});
}
///this is a patch method
patch(String filter) {
WebService().patch(url: "enter your url",body: {"id":"1"}, onResponse: (response){
print('${response.statusCode} ${response.message} ${response.data}');
});
}
///this is a delete method
delete(String filter) {
WebService().delete(url: "enter your url",body: {"id":"1"}, onResponse: (response){
print('${response.statusCode} ${response.message} ${response.data}');
});
}
Support #
If this plugin was useful to you, helped you to deliver your app, saved you a lot of time, or you just want to support the project, I would be very grateful if you buy me a cup of coffee.