SingleGetterDataSource<Type, Param> class
abstract
Implement this abstract in your data source if it can fetch some data. Note that 1 class can implements from multiple abstracts.
class GetParams {
final String token;
}
class SessionDataSource implements
SingleGetterDataSource<Session, GetParams> {
final HttpClient client;
const SessionDataSource({required this.client});
@override
FutureOr<Session> readOne({GetParams params}) async {
/// Perform client.get() or something.
}
}
If you can live with less type safety, you can simply use
Map<String,dynamic>
as Param.
Instead of throwing an exception, you should return Left instead.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readOne(
{required Param param}) → FutureOr< Type> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited