Skip to content

Commit

Permalink
docs: add readme and changelog notes, add comment to dio mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
daniilborovoy committed Nov 9, 2023
1 parent cc18bea commit b127bba
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 0.2.9 - Released on 2023-11-09

- Updated the dio package to version 5.3.3
- Upgraded the mutex package to version 3.1.0
- Added a new Dio mixin

## [0.2.8] - 2023-09-13

- Adds 1.18 to the list of supported FDI versions
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ void setup() {
}
```

Or use instance method instead.

```dart
import 'package:supertokens_flutter/dio.dart';
void setup() {
Dio dio = Dio(); // Create a Dio instance.
dio.addSupertokensInterceptor();
}
```

#### Making network requests

```dart
Expand Down
1 change: 1 addition & 0 deletions lib/dio.dart
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export 'src/dio-interceptor-wrapper.dart' show SuperTokensInterceptorWrapper;
export "src/supertokens_dio_extension.dart" show SuperTokensDioExtension;
19 changes: 15 additions & 4 deletions lib/src/supertokens_dio_extension.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import 'package:dio/dio.dart';
import 'package:supertokens_flutter/src/dio-interceptor-wrapper.dart';

/// Mixin for easy Dio instance setup.
///
/// Usage:
/// ```dart
///
/// final dio = Dio()
/// ..addSupertokensInterceptor()
/// ..addSentry()
/// // ...
/// ```
extension SuperTokensDioExtension on Dio {
void addSupertokensInterceptor() {
this.interceptors.add(SuperTokensInterceptorWrapper(client: this));
}
}
/// Adds the SuperTokens interceptor to the Dio instance.
void addSupertokensInterceptor() {
this.interceptors.add(SuperTokensInterceptorWrapper(client: this));
}
}
3 changes: 1 addition & 2 deletions lib/supertokens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
library supertokens;

export "src/supertokens.dart";
export "src/errors.dart";
export "src/supertokens_dio_extension.dart";
export "src/errors.dart";

0 comments on commit b127bba

Please sign in to comment.