easy_api_client 1.0.1 easy_api_client: ^1.0.1 copied to clipboard
Api Client for easy integration with RESTful APIs
easy_api_client #
easy_api_client
is a Dart package designed to simplify integration with RESTful APIs by providing an easy-to-use API client.
Features #
- Simplified API Calls: Easily make GET, POST, PUT, DELETE requests with minimal code.
- Error Handling: Built-in error handling for common HTTP status codes and network issues.
- Configurable: Customize headers, timeouts, and other HTTP client settings.
- Asynchronous: Fully asynchronous operations using Dart's
async
andawait
for non-blocking requests.
Installation #
Add the following to your pubspec.yaml
:
dependencies:
easy_api_client: ^1.0.0
Then, run flutter pub get.
Usage
Import the package:
dart
Copy code
import 'package:easy_api_client/easy_api_client.dart';
Create an instance of EasyApiClient:
dart
Copy code
final apiClient = EasyApiClient(baseUrl: 'https://api.example.com');
Making GET Requests
dart
Copy code
try {
final response = await apiClient.get('/users');
// Handle successful response
} catch (e) {
// Handle error
}
Making POST Requests
dart
Copy code
try {
final response = await apiClient.post('/users', body: {'name': 'John Doe'});
// Handle successful response
} catch (e) {
// Handle error
}
For more details and advanced usage, refer to the API Reference.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub.
License
This project is licensed under the MIT License - see the LICENSE file for details.
markdown
Copy code
### Explanation:
- **Title and Badges**: Start with a clear title (`easy_api_client`) and include badges such as the version badge from Pub and build status badge.
- **Introduction**: Briefly describe what the package does (`easy_api_client` for easy integration with RESTful APIs).
- **Features**: List key features that the package provides to users.
- **Installation**: Provide clear instructions on how to install the package using `pubspec.yaml` and `flutter pub get`.
- **Usage**: Provide examples and code snippets for basic usage scenarios, such as making GET and POST requests.
- **API Reference**: Link to the API reference documentation for more detailed information.
- **Contributing**: Encourage contributions and provide links to GitHub repository for issues and pull requests.
- **License**: Specify the license under which the package is released.
Customize this template according to your specific package features and details, and make sure to replace placeholders like `your_username` with your actual GitHub username or repository name. This will help users understand your package quickly and effectively use it in their projects.