httpservice 1.0.2 copy "httpservice: ^1.0.2" to clipboard
httpservice: ^1.0.2 copied to clipboard

A project that contains helper classes to help with http package.(only get is supported for now)

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);
  }

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);
  }

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}');
  }

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}');
  }

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"}');
  }

DELETE #

import 'dart:convert';
import 'package:httpservice/httpservice.dart';

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

2
likes
120
pub points
28%
popularity

Publisher

unverified uploader

A project that contains helper classes to help with http package.(only get is supported for now)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on httpservice