HttpRepository<Data> constructor
HttpRepository<Data> ({})
Creates a HttpRepository that fetches data from an endpoint.
The endpoint is the only required parameter.
The fromJson
function is optional
and defaults to returning the json as is.
The autoRefreshInterval
is optional and defaults to null.
The resolveOnCreate
is optional and defaults to true.
If autoRefreshInterval
is not null, the repository will automatically
Implementation
HttpRepository({
required this.endpoint,
Data Function(String json)? fromJson,
FutureOr<bool> Function(Exception exception)? shouldRetryCondition,
super.resolveOnCreate,
super.autoRefreshInterval,
super.tag,
String? name,
}) : _fromJson = fromJson ?? ((json) => json as Data),
_shouldRetryCondition = shouldRetryCondition,
_name = name,
super();