ez_http 1.0.8 copy "ez_http: ^1.0.8" to clipboard
ez_http: ^1.0.8 copied to clipboard

A lightweight Flutter package that simplifies HTTP requests, providing an easy-to-use interface

Easy HTTP #

Easy HTTP is a lightweight Flutter package that simplifies HTTP requests, making it effortless to perform GET, POST, PUT, and DELETE operations. With an intuitive API, you can start making network requests right away without any complex setup.

Features #

  • 🚀 Simple and intuitive API for HTTP requests
  • 🔧 Supports GET, POST, PUT, and DELETE methods out of the box
  • 🎯 Minimal setup required - start using it immediately
  • 🔄 Easy handling of JSON data
  • 🛠 Customizable headers and request parameters

Getting started #

To use this package, add ez_http as a dependency in your pubspec.yaml file:

dependencies:
  ez_http: ^1.0.8

Then run dart pub get or flutter pub get to install the package.

Usage #

Here are some quick examples to get you started with Easy HTTP:

GET Request #

import 'package:ez_http/ez_http.dart';

void main() async {
  Map<String, dynamic> response = await EasyHttp.get<Map<String, dynamic>>(
    'https://api.example.com/users',
    responseBodyType: ResponseBodyType.json,
  );
  final response2 = await EasyHttp.get(
    'https://api.example.com/users2',
    responseBodyType: ResponseBodyType.json,
  );
  print(response.body);
}

POST Request #

import 'package:ez_http/ez_http.dart';

void main() async {
  Map<String, dynamic> response = await EasyHttp.post<Map<String, dynamic>>(
    'https://api.example.com/users',
    body: {'name': 'John Doe', 'email': 'john@example.com'},
    responseBodyType: ResponseBodyType.json,
    contentType: ContentType.json,
  );
  print(response.statusCode);
  print(response.body);
}

PUT Request #

import 'package:ez_http/ez_http.dart';

void main() async {
  Map<String, dynamic> response = await EasyHttp.put<Map<String, dynamic>>(
    'https://api.example.com/users/1',
    body: {'name': 'Jane Doe'},
    responseBodyType: ResponseBodyType.json,
    contentType: ContentType.json,
  );
  print(response.statusCode);
}

DELETE Request #

import 'package:ez_http/ez_http.dart';

void main() async {
  Map<String, dynamic> response = await EasyHttp.delete<Map<String, dynamic>>(
    'https://api.example.com/users/1',
  );
  print(response.statusCode);
}

Additional information #

For more detailed examples and advanced usage, please check out the /example folder in the package repository.

Contributing #

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please file an issue on the GitHub repository.

License #

This package is released under the MIT License. See the LICENSE file for details.

3
likes
140
points
36
downloads

Publisher

verified publisherinfinverse.dev

Weekly Downloads

A lightweight Flutter package that simplifies HTTP requests, providing an easy-to-use interface

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on ez_http