From d204a403fdc1fbf6a0a360f978984afefb927623 Mon Sep 17 00:00:00 2001 From: Nemi Shah Date: Wed, 15 Nov 2023 16:29:21 +0530 Subject: [PATCH] Fix flutter code type checking --- .../custom-ui/handling-session-tokens.mdx | 14 ++++++++++---- .../custom-ui/handling-session-tokens.mdx | 14 ++++++++++---- v2/session/quick-setup/handling-session-tokens.mdx | 14 ++++++++++---- .../plugins/codeTypeChecking/dart_env/pubspec.lock | 2 +- .../plugins/codeTypeChecking/dart_env/pubspec.yaml | 1 + .../custom-ui/handling-session-tokens.mdx | 14 ++++++++++---- .../custom-ui/handling-session-tokens.mdx | 14 ++++++++++---- .../custom-ui/handling-session-tokens.mdx | 14 ++++++++++---- 8 files changed, 62 insertions(+), 25 deletions(-) diff --git a/v2/emailpassword/custom-ui/handling-session-tokens.mdx b/v2/emailpassword/custom-ui/handling-session-tokens.mdx index e5dbefe74..7268e409f 100644 --- a/v2/emailpassword/custom-ui/handling-session-tokens.mdx +++ b/v2/emailpassword/custom-ui/handling-session-tokens.mdx @@ -215,7 +215,7 @@ You can make requests as you normally would with `http`, the only difference is // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); var response = await http.get(uri); // handle response @@ -230,11 +230,13 @@ If you use a custom http client and want to use SuperTokens, you can simply prov // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); + // Initialise your custom client + var customClient = http.Client(); // provide your custom client to SuperTokens - var httpClient = http.Client(client: customClient) + var httpClient = http.Client(client: customClient); var response = await httpClient.get(uri); // handle response @@ -250,6 +252,7 @@ Use the extension method provided by the SuperTokens SDK to enable interception ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { Dio dio = Dio(); // Create a Dio instance. @@ -263,9 +266,12 @@ You can make requests as you normally would with `dio`. ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { - Dio dio = Dio(...) + Dio dio = Dio( + // Provide your config here + ); dio.addSupertokensInterceptor(); var response = dio.get("http://localhost:3001/api"); diff --git a/v2/passwordless/custom-ui/handling-session-tokens.mdx b/v2/passwordless/custom-ui/handling-session-tokens.mdx index e5dbefe74..7268e409f 100644 --- a/v2/passwordless/custom-ui/handling-session-tokens.mdx +++ b/v2/passwordless/custom-ui/handling-session-tokens.mdx @@ -215,7 +215,7 @@ You can make requests as you normally would with `http`, the only difference is // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); var response = await http.get(uri); // handle response @@ -230,11 +230,13 @@ If you use a custom http client and want to use SuperTokens, you can simply prov // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); + // Initialise your custom client + var customClient = http.Client(); // provide your custom client to SuperTokens - var httpClient = http.Client(client: customClient) + var httpClient = http.Client(client: customClient); var response = await httpClient.get(uri); // handle response @@ -250,6 +252,7 @@ Use the extension method provided by the SuperTokens SDK to enable interception ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { Dio dio = Dio(); // Create a Dio instance. @@ -263,9 +266,12 @@ You can make requests as you normally would with `dio`. ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { - Dio dio = Dio(...) + Dio dio = Dio( + // Provide your config here + ); dio.addSupertokensInterceptor(); var response = dio.get("http://localhost:3001/api"); diff --git a/v2/session/quick-setup/handling-session-tokens.mdx b/v2/session/quick-setup/handling-session-tokens.mdx index e5dbefe74..7268e409f 100644 --- a/v2/session/quick-setup/handling-session-tokens.mdx +++ b/v2/session/quick-setup/handling-session-tokens.mdx @@ -215,7 +215,7 @@ You can make requests as you normally would with `http`, the only difference is // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); var response = await http.get(uri); // handle response @@ -230,11 +230,13 @@ If you use a custom http client and want to use SuperTokens, you can simply prov // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); + // Initialise your custom client + var customClient = http.Client(); // provide your custom client to SuperTokens - var httpClient = http.Client(client: customClient) + var httpClient = http.Client(client: customClient); var response = await httpClient.get(uri); // handle response @@ -250,6 +252,7 @@ Use the extension method provided by the SuperTokens SDK to enable interception ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { Dio dio = Dio(); // Create a Dio instance. @@ -263,9 +266,12 @@ You can make requests as you normally would with `dio`. ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { - Dio dio = Dio(...) + Dio dio = Dio( + // Provide your config here + ); dio.addSupertokensInterceptor(); var response = dio.get("http://localhost:3001/api"); diff --git a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock index 1c39a5a8e..1bf5bd73e 100644 --- a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock +++ b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock @@ -50,7 +50,7 @@ packages: source: hosted version: "1.0.5" dio: - dependency: transitive + dependency: "direct main" description: name: dio sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7" diff --git a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml index bbae8d3de..e84ec8261 100644 --- a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml +++ b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml @@ -38,6 +38,7 @@ dependencies: supertokens_flutter: ^0.3.0 google_sign_in: ^6.1.4 sign_in_with_apple: ^5.0.0 + dio: ^5.3.3 dev_dependencies: flutter_test: diff --git a/v2/thirdparty/custom-ui/handling-session-tokens.mdx b/v2/thirdparty/custom-ui/handling-session-tokens.mdx index e5dbefe74..7268e409f 100644 --- a/v2/thirdparty/custom-ui/handling-session-tokens.mdx +++ b/v2/thirdparty/custom-ui/handling-session-tokens.mdx @@ -215,7 +215,7 @@ You can make requests as you normally would with `http`, the only difference is // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); var response = await http.get(uri); // handle response @@ -230,11 +230,13 @@ If you use a custom http client and want to use SuperTokens, you can simply prov // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); + // Initialise your custom client + var customClient = http.Client(); // provide your custom client to SuperTokens - var httpClient = http.Client(client: customClient) + var httpClient = http.Client(client: customClient); var response = await httpClient.get(uri); // handle response @@ -250,6 +252,7 @@ Use the extension method provided by the SuperTokens SDK to enable interception ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { Dio dio = Dio(); // Create a Dio instance. @@ -263,9 +266,12 @@ You can make requests as you normally would with `dio`. ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { - Dio dio = Dio(...) + Dio dio = Dio( + // Provide your config here + ); dio.addSupertokensInterceptor(); var response = dio.get("http://localhost:3001/api"); diff --git a/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx b/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx index e5dbefe74..7268e409f 100644 --- a/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx +++ b/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx @@ -215,7 +215,7 @@ You can make requests as you normally would with `http`, the only difference is // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); var response = await http.get(uri); // handle response @@ -230,11 +230,13 @@ If you use a custom http client and want to use SuperTokens, you can simply prov // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); + // Initialise your custom client + var customClient = http.Client(); // provide your custom client to SuperTokens - var httpClient = http.Client(client: customClient) + var httpClient = http.Client(client: customClient); var response = await httpClient.get(uri); // handle response @@ -250,6 +252,7 @@ Use the extension method provided by the SuperTokens SDK to enable interception ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { Dio dio = Dio(); // Create a Dio instance. @@ -263,9 +266,12 @@ You can make requests as you normally would with `dio`. ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { - Dio dio = Dio(...) + Dio dio = Dio( + // Provide your config here + ); dio.addSupertokensInterceptor(); var response = dio.get("http://localhost:3001/api"); diff --git a/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx b/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx index e5dbefe74..7268e409f 100644 --- a/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx +++ b/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx @@ -215,7 +215,7 @@ You can make requests as you normally would with `http`, the only difference is // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); var response = await http.get(uri); // handle response @@ -230,11 +230,13 @@ If you use a custom http client and want to use SuperTokens, you can simply prov // Import http from the SuperTokens package import 'package:supertokens_flutter/http.dart' as http; -Future makeRequest() { +Future makeRequest() async { Uri uri = Uri.parse("http://localhost:3001/api"); + // Initialise your custom client + var customClient = http.Client(); // provide your custom client to SuperTokens - var httpClient = http.Client(client: customClient) + var httpClient = http.Client(client: customClient); var response = await httpClient.get(uri); // handle response @@ -250,6 +252,7 @@ Use the extension method provided by the SuperTokens SDK to enable interception ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { Dio dio = Dio(); // Create a Dio instance. @@ -263,9 +266,12 @@ You can make requests as you normally would with `dio`. ```dart import 'package:supertokens_flutter/dio.dart'; +import 'package:dio/dio.dart'; void setup() { - Dio dio = Dio(...) + Dio dio = Dio( + // Provide your config here + ); dio.addSupertokensInterceptor(); var response = dio.get("http://localhost:3001/api");