LikeOfflineSyncInterceptor constructor

LikeOfflineSyncInterceptor({
  1. required Dio dio,
  2. required Box queueBox,
  3. LikeAuthConfig? authConfig,
  4. LikeReplayCodec codec = const DefaultLikeReplayCodec(),
  5. bool autoSchedule = false,
  6. LikeSessionScope currentSession()?,
  7. FutureOr<void> notifyRefresh(
    1. String path
    )?,
})

Implementation

LikeOfflineSyncInterceptor({
  required this.dio,
  required this._queueBox,
  this.authConfig,
  this.codec = const DefaultLikeReplayCodec(),
  this.autoSchedule = false,
  LikeSessionScope Function()? currentSession,
  FutureOr<void> Function(String path)? notifyRefresh,
}) : currentSession = currentSession ?? (() => const LikeSessionScope()),
     _notifyRefresh =
         notifyRefresh ?? ((path) => LikeClient().notifyRefresh(path)) {
  if (autoSchedule) {
    _queueSubscription = _queueBox.watch().listen((_) {
      _publish();
      _scheduleNext();
    });
    _scheduleNext();
  }
}