Sweet Fetch

Sweet Fetch is a Dio-based HTTP client manager that allows you to easily configure token refresh, error handling, and custom HTTP settings. It is designed to provide a clean and efficient API client layer for Flutter and Dart projects.

πŸš€ Features

β€’	πŸ” Token-based authentication (OAuth2 support)
β€’	πŸ”„ Automatic token refresh (refresh token support)
β€’	🧠 Smart error interception and redirection
β€’	πŸ“¦ Custom HttpClientManager built on Dio
β€’	🧰 Hive-powered TokenStorage
β€’	πŸ§ͺ Test-friendly architecture

Usage

    final sweetFetch = SweetFetch();

    await sweetFetch.init(
            options: BaseOptions(baseUrl: 'https://api.example.com'),
            refreshTokenConfig: RefreshTokenConfig(
            refreshUrl: 'https://api.example.com/token/refresh',
            refreshQueryParameters: {
                'client_id': 'your-client-id',
                'client_secret': 'your-client-secret',
            },
            refreshData: {
                'refresh_token': 'your-refresh-token',
            },
       ),
    );

final response = await sweetFetch.dioClient.get('/user/profile');

Additional information

β€’	Token refresh operations are compatible with fresh_dio.
β€’	Tokens are stored locally using Hive.

🀝 Contributing

Contributions are welcome! Please open an issue before submitting a pull request.

License

MIT License Β© Mert ErkoΓ§

Libraries

sweet_fetch