Fetcher<Key, T> class base

Fetcher is used by Stock to fetch network records of the type T for a given key of the type Key. The return type is Stream to allow for multiple results per request.

Note: Stock does not catch exceptions thrown by a Fetcher. Use StockResponseError to communicate expected errors.

See ofFuture for easily translating from a regular Future function. See ofStream, for easily translating to StockResponse (and automatically transforming exceptions into StockResponseError).

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

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

ofFuture<Key, Output>(Future<Output> futureFactory(Key key)) Fetcher<Key, Output>
"Creates" a Fetcher from a futureFactory and translates the results into a StockResponse.
ofStream<Key, Output>(Stream<Output> streamFactory(Key key)) Fetcher<Key, Output>
"Creates" a Fetcher from a streamFactory and translates the results into a StockResponse.