HttpRepository<Data> constructor

HttpRepository<Data>({
  1. required Uri endpoint,
  2. Data fromJson(
    1. String json
    )?,
  3. FutureOr<bool> shouldRetryCondition(
    1. Exception exception
    )?,
  4. bool resolveOnCreate = true,
  5. Duration? autoRefreshInterval,
  6. String? tag,
  7. String? name,
})

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();