MangadexClient constructor

MangadexClient(
  1. {bool autoRefresh = true,
  2. Duration? refreshDuration,
  3. bool autoSave = false,
  4. Directory? saveDirectory,
  5. String? filename}
)

Implementation

MangadexClient(
    {this.autoRefresh = true,
    this.refreshDuration,
    this.autoSave = false,
    this.saveDirectory,
    this.filename}) {
  if (saveDirectory != null && filename != null && autoSave != false) {
    loadFromLocation(saveDirectory!, filename)
        .then((value) => _token = value);
  }
  _refreshTimer =
      Timer.periodic(refreshDuration ?? Duration(minutes: 14), (timer) async {
    if (_token != null) {
      try {
        _token = (await refresh(_token!.refresh!)).token;
        log("Token Refreshed");
      } on Exception {
        _token = null;
      }
    }
  });
}