Repository<Data> constructor

Repository<Data>({
  1. Duration? autoRefreshInterval,
  2. bool resolveOnCreate = true,
})

If resolveOnCreate is true, the repository will resolve itself on creation. If autoRefreshInterval is not null, the repository will refresh itself every autoRefreshInterval.

Implementation

Repository({
  this.autoRefreshInterval,
  bool resolveOnCreate = true,
}) {
  track();

  hydrate(refreshAfter: resolveOnCreate);

  if (autoRefreshInterval != null) {
    timer = Timer.periodic(
      autoRefreshInterval!,
      (_) => refresh(),
    );
  }
}