Fetchx - Simplified http requests in Dart
Fetchx
A dart/flutter package for making HTTP requests.
Features
- Get
- Post
- Put
- Delete
- Patch
Usage
To use this package add this to your pubspec.yaml
dependencies:
fetchx: ^0.0.1
Then import the package
import 'package:fetchx/fetchx.dart';
Get
final response = await "https://jsonplaceholder.typicode.com/posts/1".get();
Post
final response = await "https://jsonplaceholder.typicode.com/posts".post({
"title": "foo",
"body": "bar",
"userId": 1
});
Put
final response = await "https://jsonplaceholder.typicode.com/posts/1".put({
"title": "foo",
"body": "bar",
"userId": 1
});
Delete
final response = await "https://jsonplaceholder.typicode.com/posts/1".delete();
Patch
final response = await "https://jsonplaceholder.typicode.com/posts/1".patch({
"title": "foo"
});