MatexDataProvider<T> class
abstract
Abstract data provider class to fetch, parse, cache, and retrieve model data.
- Generics:
- T: The type of data model this provider handles.
- Implementers
Constructors
- MatexDataProvider({String debugLabel = 'MatexDataProvider', Duration ttl = const Duration(days: 1)})
- Constructor for the data provider.
Properties
- debugLabel → String
-
Debug label for this data provider.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
jsonCache
↔ TCacheManager<
Map< String, dynamic> > -
Cache manager for raw JSON data.
latefinal
-
modelCache
↔ TCacheManager<
T> -
Cache manager for the parsed model.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- ttl → Duration
-
Time to live duration for cached data.
final
Methods
-
dispose(
) → void - Dispose both the model and JSON cache managers.
-
fetchData(
) → Future< String> - Abstract method to fetch raw data.
-
findOne(
{required bool filter(T)}) → Future< T?> - Retrieves a single model of type T that satisfies the given filter.
-
get(
String key) → Future< T?> - Get the model of type T corresponding to the provided key.
-
list(
) → Future< List< T> > - Get all the models of type T.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
String key, Map< String, dynamic> jsonData) → T? - Parse the provided JSON data into a model of type T using the given key.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited