Skip to content

Commit

Permalink
"Refactor attempt getter and setter (solves #34)
Browse files Browse the repository at this point in the history
This change modifies the attempt getter and setter in the retry interceptor. Previously, the methods were private, which resulted in limited access for other classes. Now, they've been made public for easier data manipulation."
  • Loading branch information
rodion-m committed Oct 26, 2023
1 parent b2c0c78 commit 637106a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/dio_smart_retry.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions lib/src/retry_interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ const _kDisableRetryKey = 'ro_disable_retry';
extension RequestOptionsX on RequestOptions {
static const _kAttemptKey = 'ro_attempt';

int get _attempt => (extra[_kAttemptKey] as int?) ?? 0;

set _attempt(int value) => extra[_kAttemptKey] = value;
int get attempt => _attempt;

bool get disableRetry => (extra[_kDisableRetryKey] as bool?) ?? false;

set disableRetry(bool value) => extra[_kDisableRetryKey] = value;

int get _attempt => (extra[_kAttemptKey] as int?) ?? 0;

set _attempt(int value) => extra[_kAttemptKey] = value;
}

extension OptionsX on Options {
Expand Down

0 comments on commit 637106a

Please sign in to comment.