easy_api_call 0.0.5 copy "easy_api_call: ^0.0.5" to clipboard
easy_api_call: ^0.0.5 copied to clipboard

A reusable HTTP API service with token management.


๐Ÿ” easy_api_call #

A flexible and developer-friendly Flutter package for handling HTTP network requests using Dio with automatic token-based authentication, refresh token handling, and full support for all major HTTP methods (GET, POST, PUT, DELETE, PATCH).


โœจ Features #

  • ๐Ÿ” Auto Token Refresh: Automatically refresh access tokens when they expire (on 401 responses).
  • ๐Ÿ” Optional Authentication: Easily toggle between authenticated and unauthenticated requests.
  • ๐ŸŒ Supports All HTTP Methods: Clean, unified interface for GET, POST, PUT, DELETE, and PATCH.
  • ๐Ÿ”ง Dynamic Configuration: Configure base URL, access token, refresh token, and refresh URL at runtime.
  • ๐Ÿงพ Integrated Logging: Uses PrettyDioLogger for clean, structured logging of all request/response data.
  • โš ๏ธ SSL Certificate Bypass (for dev): Allows development with self-signed certificates (optional).
  • ๐Ÿช Interceptor-based Error Handling: Easily hook into Dio's interceptors to customize error and retry logic.

๐Ÿš€ Usage #

import 'package:api_service_plus/api_service_plus.dart';

void main() async {
  final api = ApiService();

  api.configure(
    baseUrl: 'https://your-api.com',
    token: 'access_token',
    refreshToken: 'refresh_token',
    refreshTokenUrl: 'https://your-api.com/auth/refresh',
  );

  try {
    // Perform authenticated GET request
    final response = await api.get('/user/profile', requiresAuth: true);
    print(response.data);
  } catch (e) {
    print('Request failed: $e');
  }
}

---

โœ๏ธ Author
<a href="https://github.com/Badhon100" target="_blank"> <img src="https://avatars.githubusercontent.com/u/32125810?v=4" width="100" height="100" style="border-radius: 50%;" alt="Nahiduzzaman Badhon"/> <p align="center"><b>Nahiduzzaman Badhon</b></p> </a> <p align="center"> Built and maintained with โค๏ธ </p>

๐Ÿค Contributor
<a href="https://github.com/zsifat" target="_blank"> <img src="https://avatars.githubusercontent.com/u/180648658?v=4" width="100" height="100" style="border-radius: 50%;" alt="ZAHIDUL ISLAM"/> <p align="center"><b>ZAHIDUL ISLAM</b></p> </a> <p align="center"> Contributed with โค๏ธ </p>
10
likes
0
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A reusable HTTP API service with token management.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, pretty_dio_logger

More

Packages that depend on easy_api_call