apinion 0.0.3
apinion: ^0.0.3 copied to clipboard
Simplify API calls in Dart & Flutter with Apinion — clean syntax, built-in logging, and easy setup.
Apinion is a lightweight, developer-friendly Dart package that simplifies REST API calls in your Flutter or Dart apps.
- 🔐 Optional API key support
- 🌐 Base URL set once
- ⏱ Customizable timeout duration
- 🪄 One-liner HTTP calls: GET, POST, PUT, PATCH, DELETE
- 🖼️ File/image upload support
- 🪵 Built-in pretty logger using
logger
package
🔍 Example #
import 'package:apinion/apinion.dart';
void main() async {
ApinionConfig.init(
baseUrl: 'https://jsonplaceholder.typicode.com',
);
// GET request
final getResponse = await ApinionClient.get('/posts/1');
if (getResponse.isSuccess) {
print('Title: ${getResponse.responseData['title']}');
} else {
print('Error: ${getResponse.errorMessage}');
}
// POST request
final postResponse = await ApinionClient.post('/posts', body: {
'title': 'foo',
'body': 'bar',
'userId': 1,
});
if (postResponse.isSuccess) {
print('New Post ID: ${postResponse.responseData['id']}');
}
}