fetchData method

Future<T?> fetchData({
  1. required String url,
  2. required Duration duration,
  3. Client? client,
})

Fetch data from HiveDB with url as a key. If the database is empty, Sends an HTTP GET request to the given url then store the data in the HiveDB with duration as the age of the data.

Return Dart object.

Implementation

Future<T?> fetchData(
    {required String url, required Duration duration, http.Client? client}) {
  return cache.CacheData<T>(client: client).checkDb(url, duration);
}