From b127bbab53f80b3102e3ee830f74f40d6e3c0761 Mon Sep 17 00:00:00 2001 From: Daniil Borovoy Date: Thu, 9 Nov 2023 18:54:45 +0300 Subject: [PATCH] docs: add readme and changelog notes, add comment to dio mixin --- CHANGELOG.md | 6 ++++++ README.md | 11 +++++++++++ lib/dio.dart | 1 + lib/src/supertokens_dio_extension.dart | 19 +++++++++++++++---- lib/supertokens.dart | 3 +-- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cfcc12..964ea8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 3f5f7d5..067e3d4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/dio.dart b/lib/dio.dart index 1890346..6e33bc3 100644 --- a/lib/dio.dart +++ b/lib/dio.dart @@ -1 +1,2 @@ export 'src/dio-interceptor-wrapper.dart' show SuperTokensInterceptorWrapper; +export "src/supertokens_dio_extension.dart" show SuperTokensDioExtension; \ No newline at end of file diff --git a/lib/src/supertokens_dio_extension.dart b/lib/src/supertokens_dio_extension.dart index c8c875b..5a83cd1 100644 --- a/lib/src/supertokens_dio_extension.dart +++ b/lib/src/supertokens_dio_extension.dart @@ -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)); - } -} \ No newline at end of file + /// Adds the SuperTokens interceptor to the Dio instance. + void addSupertokensInterceptor() { + this.interceptors.add(SuperTokensInterceptorWrapper(client: this)); + } +} diff --git a/lib/supertokens.dart b/lib/supertokens.dart index 9655574..3b1f117 100644 --- a/lib/supertokens.dart +++ b/lib/supertokens.dart @@ -5,5 +5,4 @@ library supertokens; export "src/supertokens.dart"; -export "src/errors.dart"; -export "src/supertokens_dio_extension.dart"; \ No newline at end of file +export "src/errors.dart"; \ No newline at end of file