Skip to main content

BaseFeedManager<[T>] class abstract

An abstract base class for managing a feed of type T with caching and online data fetching capabilities.

This class provides methods for initializing a cache, loading cached data, saving data to cache, and fetching new data from an API. It also handles automatic cache refreshing when online.

params:

  • cacheKey: A unique key for identifying the cache box in Hive.

methods:

  • loadCachedData: Loads the data cached in Hive for the specified cacheKey.
  • saveDataToCache: Saves a list of data to the cache, clearing any existing data in the process.
  • fetchDataFromApi: Abstract method to be implemented by subclasses for fetching data from an API.
  • getNewFeedAndRefreshCache: Fetches new data from the API if online, updates the cache, and returns the data. If offline, it loads and returns cached data.

Implementers

: - EventService

Constructors

[BaseFeedManager][([[String] cacheKey])]

:

Properties

[cacheKey] [→ String] : feed cacheBox key. ::: features final :::

[hashCode] [→ int] : The hash code for this object. ::: features no setterinherited :::

[runtimeType] [→ Type] : A representation of the runtime type of the object. ::: features no setterinherited :::

Methods

[fetchDataFromApi][ [→ Future[<[List<[T>]]>]] ] : Abstract method to be implemented by subclasses to fetch data from an API.

[getNewFeedAndRefreshCache][ [→ Future[<[List<[T>]]>]] ] : Fetches new data from the API if online, updates the cache, and returns the data.

[loadCachedData][ [→ Future[<[List<[T>]]>]] ] : Loads the data cached in Hive.

[noSuchMethod][([[Invocation] invocation]) → dynamic ] : Invoked when a nonexistent method or property is accessed. ::: features inherited :::

[saveDataToCache][([[List<[T>]] data]) [→ Future<[void>]] ] : Saves a list of data to the cache, replacing any existing data.

[toString][ [→ String] ] : A string representation of this object. ::: features inherited :::

Operators

[operator ==][([[Object] other]) [→ bool] ] : The equality operator. ::: features inherited :::

  1. talawa
  2. base_feed_manager
  3. BaseFeedManager<[T>] class
base_feed_manager library