diff --git a/.github/workflows/functions_client_ci.yml b/.github/workflows/functions_client_ci.yml index 9a028203..393ca094 100644 --- a/.github/workflows/functions_client_ci.yml +++ b/.github/workflows/functions_client_ci.yml @@ -24,7 +24,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/.github/workflows/gotrue_ci.yml b/.github/workflows/gotrue_ci.yml index 1c99e690..604b1e83 100644 --- a/.github/workflows/gotrue_ci.yml +++ b/.github/workflows/gotrue_ci.yml @@ -21,7 +21,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/.github/workflows/postgrest_ci.yml b/.github/workflows/postgrest_ci.yml index db6844aa..9dec79d6 100644 --- a/.github/workflows/postgrest_ci.yml +++ b/.github/workflows/postgrest_ci.yml @@ -23,7 +23,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/.github/workflows/realtime_client_ci.yml b/.github/workflows/realtime_client_ci.yml index 0d2380d0..9de99421 100644 --- a/.github/workflows/realtime_client_ci.yml +++ b/.github/workflows/realtime_client_ci.yml @@ -21,7 +21,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/.github/workflows/storage_client_ci.yml b/.github/workflows/storage_client_ci.yml index 911d5447..f331416e 100644 --- a/.github/workflows/storage_client_ci.yml +++ b/.github/workflows/storage_client_ci.yml @@ -20,7 +20,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/.github/workflows/supabase_ci.yml b/.github/workflows/supabase_ci.yml index d4e393c1..a48be970 100644 --- a/.github/workflows/supabase_ci.yml +++ b/.github/workflows/supabase_ci.yml @@ -31,7 +31,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/.github/workflows/supabase_flutter_ci.yml b/.github/workflows/supabase_flutter_ci.yml index cb43d475..9c4340a2 100644 --- a/.github/workflows/supabase_flutter_ci.yml +++ b/.github/workflows/supabase_flutter_ci.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - flutter-version: ['3.0.0', '3.x'] + flutter-version: ['3.10.x', '3.x'] defaults: run: diff --git a/.github/workflows/yet_another_json_isolate_ci.yml b/.github/workflows/yet_another_json_isolate_ci.yml index 3446bf2f..13244160 100644 --- a/.github/workflows/yet_another_json_isolate_ci.yml +++ b/.github/workflows/yet_another_json_isolate_ci.yml @@ -21,7 +21,7 @@ jobs: matrix: os: [ubuntu-latest] node: ['12'] - sdk: [2.17.0, stable, beta, dev] + sdk: [stable, beta, dev] defaults: run: diff --git a/packages/functions_client/pubspec.yaml b/packages/functions_client/pubspec.yaml index ddad1156..ef258290 100644 --- a/packages/functions_client/pubspec.yaml +++ b/packages/functions_client/pubspec.yaml @@ -6,12 +6,12 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/fun documentation: 'https://supabase.com/docs/reference/dart/functions-invoke' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: http: '>=0.13.4 <2.0.0' yet_another_json_isolate: ^1.1.1 dev_dependencies: - lints: ^1.0.1 + lints: ^2.1.1 test: ^1.16.4 diff --git a/packages/gotrue/pubspec.yaml b/packages/gotrue/pubspec.yaml index 450a8d0d..44a130d2 100644 --- a/packages/gotrue/pubspec.yaml +++ b/packages/gotrue/pubspec.yaml @@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/got documentation: 'https://supabase.com/docs/reference/dart/auth-signup' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: collection: ^1.15.0 @@ -19,8 +19,8 @@ dependencies: dev_dependencies: dart_jsonwebtoken: ^2.4.1 - dotenv: ^3.0.0 - lints: ^1.0.1 + dotenv: ^4.1.0 + lints: ^2.1.1 test: ^1.16.4 otp: ^3.1.3 diff --git a/packages/gotrue/test/admin_test.dart b/packages/gotrue/test/admin_test.dart index c692b1ed..76954d42 100644 --- a/packages/gotrue/test/admin_test.dart +++ b/packages/gotrue/test/admin_test.dart @@ -1,6 +1,6 @@ import 'dart:math'; -import 'package:dotenv/dotenv.dart' show env, load; +import 'package:dotenv/dotenv.dart'; import 'package:gotrue/gotrue.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; @@ -8,7 +8,8 @@ import 'package:test/test.dart'; import 'utils.dart'; void main() { - load(); // Load env variables from .env file + final env = DotEnv(); + env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; @@ -24,8 +25,8 @@ void main() { client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer ${getServiceRoleToken()}', - 'apikey': getServiceRoleToken(), + 'Authorization': 'Bearer ${getServiceRoleToken(env)}', + 'apikey': getServiceRoleToken(env), }, ); }); diff --git a/packages/gotrue/test/client_test.dart b/packages/gotrue/test/client_test.dart index 352d1e0c..5fe39d06 100644 --- a/packages/gotrue/test/client_test.dart +++ b/packages/gotrue/test/client_test.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:dotenv/dotenv.dart' show env, load; +import 'package:dotenv/dotenv.dart'; import 'package:gotrue/gotrue.dart'; import 'package:http/http.dart' as http; import 'package:jwt_decode/jwt_decode.dart'; @@ -10,7 +10,9 @@ import 'custom_http_client.dart'; import 'utils.dart'; void main() { - load(); // Load env variables from .env file + final env = DotEnv(); + + env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; @@ -45,8 +47,8 @@ void main() { adminClient = client = GoTrueClient( url: gotrueUrl, headers: { - 'Authorization': 'Bearer ${getServiceRoleToken()}', - 'apikey': getServiceRoleToken(), + 'Authorization': 'Bearer ${getServiceRoleToken(env)}', + 'apikey': getServiceRoleToken(env), }, asyncStorage: asyncStorage, ); diff --git a/packages/gotrue/test/provider_test.dart b/packages/gotrue/test/provider_test.dart index 78265667..f462050e 100644 --- a/packages/gotrue/test/provider_test.dart +++ b/packages/gotrue/test/provider_test.dart @@ -1,4 +1,4 @@ -import 'package:dotenv/dotenv.dart' show env, load; +import 'package:dotenv/dotenv.dart'; import 'package:gotrue/gotrue.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; @@ -6,7 +6,9 @@ import 'package:test/test.dart'; import 'utils.dart'; void main() { - load(); // Load env variables from .env file + final env = DotEnv(); + + env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; final anonToken = env['GOTRUE_TOKEN'] ?? 'anonKey'; diff --git a/packages/gotrue/test/src/gotrue_admin_mfa_api_test.dart b/packages/gotrue/test/src/gotrue_admin_mfa_api_test.dart index 5836ea04..112219b3 100644 --- a/packages/gotrue/test/src/gotrue_admin_mfa_api_test.dart +++ b/packages/gotrue/test/src/gotrue_admin_mfa_api_test.dart @@ -1,5 +1,5 @@ import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart'; -import 'package:dotenv/dotenv.dart' show env, load; +import 'package:dotenv/dotenv.dart'; import 'package:gotrue/gotrue.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; @@ -7,7 +7,9 @@ import 'package:test/test.dart'; import '../utils.dart'; void main() { - load(); // Load env variables from .env file + final env = DotEnv(); + + env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; final serviceRoleToken = JWT( diff --git a/packages/gotrue/test/src/gotrue_mfa_api_test.dart b/packages/gotrue/test/src/gotrue_mfa_api_test.dart index 6cbda5fd..e4eac452 100644 --- a/packages/gotrue/test/src/gotrue_mfa_api_test.dart +++ b/packages/gotrue/test/src/gotrue_mfa_api_test.dart @@ -1,5 +1,5 @@ import 'package:collection/collection.dart'; -import 'package:dotenv/dotenv.dart' show env, load; +import 'package:dotenv/dotenv.dart'; import 'package:gotrue/gotrue.dart'; import 'package:http/http.dart' as http; import 'package:otp/otp.dart'; @@ -8,7 +8,9 @@ import 'package:test/test.dart'; import '../utils.dart'; void main() { - load(); // Load env variables from .env file + final env = DotEnv(); + + env.load(); // Load env variables from .env file final gotrueUrl = env['GOTRUE_URL'] ?? 'http://localhost:9998'; diff --git a/packages/gotrue/test/utils.dart b/packages/gotrue/test/utils.dart index 5615997e..115d374b 100644 --- a/packages/gotrue/test/utils.dart +++ b/packages/gotrue/test/utils.dart @@ -37,7 +37,7 @@ String getNewPhone() { return '$timestamp'; } -String getServiceRoleToken() { +String getServiceRoleToken(DotEnv env) { return JWT( { 'role': 'service_role', diff --git a/packages/postgrest/lib/src/postgrest_query_builder.dart b/packages/postgrest/lib/src/postgrest_query_builder.dart index 3260824d..4c5413f1 100644 --- a/packages/postgrest/lib/src/postgrest_query_builder.dart +++ b/packages/postgrest/lib/src/postgrest_query_builder.dart @@ -177,7 +177,7 @@ class PostgrestQueryBuilder extends PostgrestBuilder { 'resolution=${ignoreDuplicates ? 'ignore' : 'merge'}-duplicates'; if (!defaultToNull) { - _headers['Prefer'] = _headers['Prefer']! + ',missing=default'; + _headers['Prefer'] = '${_headers['Prefer']!},missing=default'; } if (onConflict != null) { diff --git a/packages/postgrest/pubspec.yaml b/packages/postgrest/pubspec.yaml index 63e76fcc..f792d2e9 100644 --- a/packages/postgrest/pubspec.yaml +++ b/packages/postgrest/pubspec.yaml @@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/pos documentation: 'https://supabase.com/docs/reference/dart/select' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: http: '>=0.13.0 <2.0.0' @@ -14,5 +14,5 @@ dependencies: dev_dependencies: collection: ^1.16.0 - lints: ^1.0.1 + lints: ^2.1.1 test: ^1.21.4 diff --git a/packages/realtime_client/pubspec.yaml b/packages/realtime_client/pubspec.yaml index 88bb900e..a6492f88 100644 --- a/packages/realtime_client/pubspec.yaml +++ b/packages/realtime_client/pubspec.yaml @@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/rea documentation: 'https://supabase.com/docs/reference/dart/subscribe' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: collection: ^1.15.0 @@ -14,6 +14,6 @@ dependencies: web_socket_channel: ^2.3.0 dev_dependencies: - lints: ^1.0.1 - mocktail: ^0.1.0 + lints: ^2.1.1 + mocktail: ^1.0.0 test: ^1.16.5 diff --git a/packages/storage_client/lib/src/storage_file_api.dart b/packages/storage_client/lib/src/storage_file_api.dart index 47faf56d..3e1bb6a1 100644 --- a/packages/storage_client/lib/src/storage_file_api.dart +++ b/packages/storage_client/lib/src/storage_file_api.dart @@ -116,8 +116,8 @@ class StorageFileApi { 'retryAttempts has to be greater or equal to 0'); final cleanPath = _removeEmptyFolders(path); - final _path = _getFinalPath(cleanPath); - var url = Uri.parse('${this.url}/object/upload/sign/$_path'); + final finalPath = _getFinalPath(cleanPath); + var url = Uri.parse('${this.url}/object/upload/sign/$finalPath'); url = url.replace(queryParameters: {'token': token}); await storageFetch.putFile( @@ -150,8 +150,8 @@ class StorageFileApi { 'retryAttempts has to be greater or equal to 0'); final cleanPath = _removeEmptyFolders(path); - final _path = _getFinalPath(cleanPath); - var url = Uri.parse('${this.url}/object/upload/sign/$_path'); + final path0 = _getFinalPath(cleanPath); + var url = Uri.parse('${this.url}/object/upload/sign/$path0'); url = url.replace(queryParameters: {'token': token}); await storageFetch.putBinaryFile( diff --git a/packages/storage_client/pubspec.yaml b/packages/storage_client/pubspec.yaml index 48fbdcb6..2825c8f7 100644 --- a/packages/storage_client/pubspec.yaml +++ b/packages/storage_client/pubspec.yaml @@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/sto documentation: 'https://supabase.com/docs/reference/dart/storage-createbucket' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: http: '>=0.13.4 <2.0.0' @@ -18,5 +18,5 @@ dependencies: dev_dependencies: mocktail: ^0.3.0 test: ^1.21.4 - lints: ^1.0.1 + lints: ^2.1.1 path: ^1.8.2 diff --git a/packages/supabase/pubspec.yaml b/packages/supabase/pubspec.yaml index 4b2c9e64..e97b43b6 100644 --- a/packages/supabase/pubspec.yaml +++ b/packages/supabase/pubspec.yaml @@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/sup documentation: 'https://supabase.com/docs/reference/dart/introduction' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: functions_client: ^1.3.2 @@ -19,6 +19,6 @@ dependencies: yet_another_json_isolate: ^1.1.1 dev_dependencies: - lints: ^1.0.1 + lints: ^2.1.1 test: ^1.17.9 web_socket_channel: ^2.2.0 diff --git a/packages/supabase/test/utils.dart b/packages/supabase/test/utils.dart index 6f57ca6f..11c424d4 100644 --- a/packages/supabase/test/utils.dart +++ b/packages/supabase/test/utils.dart @@ -5,7 +5,7 @@ List getSessionData(DateTime dateTime) { final expiresAt = dateTime.millisecondsSinceEpoch ~/ 1000; final accessTokenMid = base64.encode(utf8.encode(json.encode( {"exp": expiresAt, "sub": "1234567890", "role": "authenticated"}))); - final accessToken = "any." + accessTokenMid + ".any"; + final accessToken = "any.$accessTokenMid.any"; final currentSession = '{"access_token":"$accessToken","expires_in":${dateTime.difference(DateTime.now()).inSeconds},"refresh_token":"-yeS4omysFs9tpUYBws9Rg","token_type":"bearer","provider_token":null,"provider_refresh_token":null,"user":{"id":"4d2583da-8de4-49d3-9cd1-37a9a74f55bd","app_metadata":{"provider":"email","providers":["email"]},"user_metadata":{"Hello":"World"},"aud":"","email":"fake1680338105@email.com","phone":"","created_at":"2023-04-01T08:35:05.208586Z","confirmed_at":null,"email_confirmed_at":"2023-04-01T08:35:05.220096086Z","phone_confirmed_at":null,"last_sign_in_at":"2023-04-01T08:35:05.222755878Z","role":"","updated_at":"2023-04-01T08:35:05.226938Z"}}'; final sessionString = diff --git a/packages/supabase_flutter/analysis_options.yaml b/packages/supabase_flutter/analysis_options.yaml index 76b426d0..8d81c200 100644 --- a/packages/supabase_flutter/analysis_options.yaml +++ b/packages/supabase_flutter/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:lints/recommended.yaml +include: package:flutter_lints/flutter.yaml linter: rules: diff --git a/packages/supabase_flutter/lib/src/supabase_auth.dart b/packages/supabase_flutter/lib/src/supabase_auth.dart index 68f206ca..5e9cdef7 100644 --- a/packages/supabase_flutter/lib/src/supabase_auth.dart +++ b/packages/supabase_flutter/lib/src/supabase_auth.dart @@ -159,17 +159,10 @@ class SupabaseAuth with WidgetsBindingObserver { @override void didChangeAppLifecycleState(AppLifecycleState state) { - // ignore:missing_enum_constant_in_switch switch (state) { case AppLifecycleState.resumed: _recoverSupabaseSession(); - break; - case AppLifecycleState.inactive: - break; - case AppLifecycleState.paused: - break; - case AppLifecycleState.detached: - break; + default: } } @@ -335,6 +328,15 @@ extension GoTrueClientSignInProvider on GoTrueClient { LaunchMode authScreenLaunchMode = LaunchMode.externalApplication, Map? queryParams, }) async { + final willOpenWebview = (authScreenLaunchMode == LaunchMode.inAppWebView || + authScreenLaunchMode == LaunchMode.platformDefault) && + context != null && + !kIsWeb && // `Platform.isIOS` throws on web, so adding a guard for web here. + Platform.isIOS; + + final NavigatorState? navigator = + willOpenWebview ? Navigator.of(context) : null; + final res = await getOAuthSignInUrl( provider: provider, redirectTo: redirectTo, @@ -343,14 +345,8 @@ extension GoTrueClientSignInProvider on GoTrueClient { ); final uri = Uri.parse(res.url!); - final willOpenWebview = (authScreenLaunchMode == LaunchMode.inAppWebView || - authScreenLaunchMode == LaunchMode.platformDefault) && - context != null && - !kIsWeb && // `Platform.isIOS` throws on web, so adding a guard for web here. - Platform.isIOS; - if (willOpenWebview) { - Navigator.of(context).push(PageRouteBuilder( + navigator!.push(PageRouteBuilder( pageBuilder: (context, animation, secondaryAnimation) { return _OAuthSignInWebView(oAuthUri: uri, redirectTo: redirectTo); })); @@ -397,7 +393,8 @@ extension GoTrueClientSignInProvider on GoTrueClient { final idToken = credential.identityToken; if (idToken == null) { - throw AuthException('Could not find ID Token from generated credential.'); + throw const AuthException( + 'Could not find ID Token from generated credential.'); } return signInWithIdToken( diff --git a/packages/supabase_flutter/pubspec.yaml b/packages/supabase_flutter/pubspec.yaml index d7ae3d88..d9adf783 100644 --- a/packages/supabase_flutter/pubspec.yaml +++ b/packages/supabase_flutter/pubspec.yaml @@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/sup documentation: 'https://supabase.com/docs/reference/dart/introduction' environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' flutter: '>=3.0.0' dependencies: @@ -29,7 +29,7 @@ dev_dependencies: dart_jsonwebtoken: ^2.4.1 flutter_test: sdk: flutter - lints: ^1.0.1 + flutter_lints: ^2.0.2 platforms: android: diff --git a/packages/supabase_flutter/test/widget_test_stubs.dart b/packages/supabase_flutter/test/widget_test_stubs.dart index d5b639a0..6dbceca2 100644 --- a/packages/supabase_flutter/test/widget_test_stubs.dart +++ b/packages/supabase_flutter/test/widget_test_stubs.dart @@ -51,7 +51,7 @@ class MockExpiredStorage extends LocalStorage { // Session expires at is at its maximum value for unix timestamp accessToken: () async => - '{"currentSession":{"token_type": "","access_token":"","expires_in":20,"refresh_token":"","user":{"app_metadata": {},"id":"","aud":"","created_at":"","role":"authenticated","updated_at":""}},"expiresAt":${((DateTime.now().subtract(Duration(seconds: 11))).millisecondsSinceEpoch / 1000).round()}}', + '{"currentSession":{"token_type": "","access_token":"","expires_in":20,"refresh_token":"","user":{"app_metadata": {},"id":"","aud":"","created_at":"","role":"authenticated","updated_at":""}},"expiresAt":${((DateTime.now().subtract(const Duration(seconds: 11))).millisecondsSinceEpoch / 1000).round()}}', persistSession: (_) async {}, removePersistedSession: () async {}, hasAccessToken: () async => true, diff --git a/packages/yet_another_json_isolate/pubspec.yaml b/packages/yet_another_json_isolate/pubspec.yaml index dfc4a74a..c73bd544 100644 --- a/packages/yet_another_json_isolate/pubspec.yaml +++ b/packages/yet_another_json_isolate/pubspec.yaml @@ -4,11 +4,11 @@ version: 1.1.1 homepage: https://github.com/supabase-community/json-isolate-dart environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: async: ^2.8.0 dev_dependencies: - lints: ^1.0.0 + lints: ^2.1.1 test: ^1.16.0 diff --git a/pubspec.lock b/pubspec.lock index 386711af..7016c037 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -314,4 +314,4 @@ packages: source: hosted version: "2.1.1" sdks: - dart: ">=2.19.0 <4.0.0" + dart: ">=3.0.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 934ae2ea..f48e78b9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: supabase_flutter_packages environment: - sdk: '>=2.18.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dev_dependencies: melos: ^3.0.1