diox library
A powerful Flutter library that enhances Dio with a simplified API response handler.
This package is designed to streamline your networking layer and improve your debugging workflow. It provides a core networking component:
- Dio Extensions (
dio_extended.dart): A wrapper around the Dio HTTP client that standardizes all responses into anApiResult<T>object. This abstracts away the boilerplatetry-catchlogic, status code checking, and JSON parsing, allowing you to write cleaner and more resilient code.
Quick Start
To get started, follow these simple steps:
-
Create an instance of the
DioExtendedclient in your widget or service class where you will be making API calls. -
Make API calls using the simplified methods like
get,post, etc. The call will return anApiResult. You can then check theisSuccessproperty to handle the response appropriately.
Classes
- DioExtended
- A base class that extends Dio functionality with standardized request handling, error wrapping, and optional token-refresh logic.
- ErrorMessages
- A collection of global error message constants used across the app.
Enums
- FormDataMethod
-
Defines which HTTP method is used for uploading
FormData.