Fetcher<Key, Output> class
abstract
Fetcher is used by Store to fetch network records for a given key. The return type is Flow to allow for multiple result per request.
Note: Store does not catch exceptions thrown by a Fetcher. This is done in order to avoid silently swallowing NPEs and such. Use ErrorFetcherResult to communicate expected errors.
See ofResult for easily translating from a regular suspend
function.
See ofFlow
, of for easily translating to FetcherResult (and
automatically transforming exceptions into ErrorFetcherResult.
Constructors
- Fetcher()
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
-
call(
Key key) → Stream< FetcherResult< Output> > -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of<
Key, Output> (Future< Output> doFetch(Key)) → Fetcher<Key, Output> - "Creates" a Fetcher from a non-Flow source and translate the results to a FetcherResult.
-
ofResult<
Key, Output> (Future< FetcherResult< doFetch(Key)) → Fetcher<Output> >Key, Output> - "Creates" a Fetcher from a non-Stream source.
-
ofResultStream<
Key, Output> (ResultStreamFactory< Key, Output> streamFactory) → Fetcher<Key, Output> -
"Creates" a Fetcher from a
streamFactory
. -
ofStream<
Key, Output> (StreamFactory< Key, Output> streamFactory) → Fetcher<Key, Output> -
"Creates" a Fetcher from a
streamFactory
and translate the results to a FetcherResult.