fliq 0.0.1 fliq: ^0.0.1 copied to clipboard
Fliq is a simple and fluent Flutter library for building Restful clients with a focus on ease of use and readability. Supports cookies, interceptors and authentication.
Fliq - Flutter Rest Client Library #
Fliq is a simple and fluent Flutter library for building Restful clients with a focus on ease of use and readability. It provides a clean and concise API for making HTTP requests, supporting features such as hierarchical paths, query parameters, headers, and JSON request encoding.
Getting Started #
-
Install the Package:
Add the following to your
pubspec.yaml
file:dependencies: fliq: ^1.0.0
Then run:
flutter pub get
-
Import Fliq:
import 'package:fliq/fliq.dart';
-
Create an Instance:
final client = Fliq();
-
Make Requests:
// Example 1: Hierarchical paths final response1 = await client .get('http://localhost:8080/api/book/1') .go(); print('Example 1: ${response1.statusCode}'); // Example 2: Hierarchical paths with path() method final response2 = await client .get('http://localhost:8080/api') .path('book') .path('1') .go(); print('Example 2: ${response2.statusCode}'); // Example 3: Query parameters final response3 = await client .get('/books') .query('page', '2') .go(); print('Example 3: ${response3.statusCode}'); // Example 4: Headers final response4 = await client .get('/book') .header('page', '2') .go(); print('Example 4: ${response4.statusCode}'); // Example 5: JSON request encoding final response5 = await client .post('/book') .json({'id': '1', 'title': 'Harry Potter'}) .go(); print('Example 5: ${response5.statusCode}');
Features #
-
Hierarchical Paths: Easily build hierarchical paths for your RESTful endpoints.
-
Query Parameters: Add query parameters to your requests with a fluent API.
-
Headers: Include custom headers in your requests for authentication or other purposes.
-
JSON Request Encoding: Send JSON-encoded request bodies effortlessly.
-
JSON Response Decoding: Decode JSON responses into Dart objects using a provided mapping function.
-
Multiple HTTP Methods: Support for various HTTP methods including GET, POST, PUT, and DELETE.
Examples #
Check the example.dart
file for a comprehensive set of usage examples showcasing different features.
Contributing #
Contributions are welcome! Feel free to open issues, submit pull requests, or suggest improvements. Let's build a robust and user-friendly Flutter Rest Client library together!