JsonHttpFetcher<T> class abstract

Base class for implementing fetchers

Example:

class UserFetcher extends JsonHttpFetcher<User> {
  const UserFetcher(super.client);

  @override
  Future<User> parse(String source) async => User.fromJson(json.decode(source))!;
}
Implementers

Constructors

JsonHttpFetcher.new(JsonHttpClient _client)
const

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

fetch(String url, {dynamic nocache = false, dynamic allowErrorWhenCacheExists = false, Map<String, String>? headers, String? cacheUrl, String? body, bool usePost = false}) Stream<T>
by default, if cached version is available then errors will not be pushed to stream nocache skip cached version allowErrorWhenCacheExists throw errors even if cache is exists if cacheUrl is specified, then content will be cached under it
get(String url, {Map<String, String>? headers, String? body, bool usePost = false}) Future<T>
just get without caching
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String source) FutureOr<T>
implement me: returns object parsed from json
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited