httpservice

Last updated:

0 purchases

httpservice Image
httpservice Images
Add to Cart

Description:

httpservice

httpservice #
A FLutter package that depends on http package.
Getting Started #
This package contains classes that make it
easy to consume the http package. It's multi-platform, and supports mobile, desktop,
and the browser.
It supports GET,PUT,POST,DELETE and PATCH requests
Using #
The easiest way to use this library is to initialize the class and call the function:
import 'dart:convert';
import 'package:httpservice/httpservice.dart';

void getapidata(String apix) async {
HttpService httpService = HttpService("$apix");
var data = await httpService.getContents();
var decodedData = jsonDecode(data);
print(decodedData);
}

copied to clipboard
GET #
import 'dart:convert';
import 'package:httpservice/httpservice.dart';

void getapidata(String apix) async {
HttpService httpService = HttpService("$apix");
var data = await httpService.getContents();
var decodedData = jsonDecode(data);
print(decodedData);
}

copied to clipboard
POST #
import 'dart:convert';
import 'package:httpservice/httpservice.dart';

void postapidata(String apix) async {
HttpService httpService = HttpService("$apix");
var data = await httpService.postContents(headers: {"Content-type": "application/json"},body: '{"title": "Hello", "body": "body text", "userId": 1}');
}

copied to clipboard
PUT #
import 'dart:convert';
import 'package:httpservice/httpservice.dart';

void postapidata(String apix) async {
HttpService httpService = HttpService("$apix");
var data = await httpService.putContents(headers: {"Content-type": "application/json"},body:'{"title": "Hello", "body": "body text", "userId": 1}');
}

copied to clipboard
PATCH #
import 'dart:convert';
import 'package:httpservice/httpservice.dart';

void postapidata(String apix) async {
HttpService httpService = HttpService("$apix");
var data = await httpService.putContents(headers: {"Content-type": "application/json"},body:'{"title": "Hello"}');
}

copied to clipboard
DELETE #
import 'dart:convert';
import 'package:httpservice/httpservice.dart';

void postapidata(String apix) async {
HttpService httpService = HttpService("$apix");
var data = await httpService.deleteContents();
}

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.