igot_http_service_helper 0.0.2
igot_http_service_helper: ^0.0.2 copied to clipboard
This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform (mobile, desktop, and browser) and supports multiple implementations wi [...]
Features #
TODO: This package contains a set of high-level functions and classes that make it easy to consume HTTP resources. It's multi-platform (mobile, desktop, and browser) and supports multiple implementations with DATA Base support with respect to given TTL.
1.TTL Handling:
-
When TTL is Null: The system will call the API directly and return the response.
-
When TTL is Not Null: The system will check the database for existing data.
-
If Data Exists: It will calculate the duration since the data was last updated.
-
If the Duration is Within the TTL: The system will return the data from the database.
-
If the Duration Exceeds the TTL: The system will call the API, update the data in the database, and return the API response.
-
If Data Does Not Exist: The system will call the API, store the data in the database, and return the API response.
2.Force Update Handling:
- If the forceUpdate flag is set to true, the system will: Call the API to retrieve the latest data. Update the data and TTL in the database. Return the updated data.
Getting started #
Using
import 'package:igot_http_service_helper/services/http_service.dart';
var response = await HttpService.get( ttl: Duration(hours: hour), apiUri: Uri.parse('example.com'); );
Usage #
TODO: Used By Igot Project for HTTP calls