From 72f78b3dac5e9ac11cb834bd83c8ff2569220199 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Thu, 17 Sep 2026 18:42:31 +0200 Subject: [PATCH 1/2] refactor: prune redundant comments that restate the code below them An audit of `//` comments across the SDK packages, removing ones that just restate the line or block immediately below them (mirrors supabase-swift#1367). No behavior change. --- packages/postgrest/lib/src/postgrest_filter_builder.dart | 5 ----- .../postgrest/lib/src/postgrest_transform_builder.dart | 1 - packages/supabase_auth/lib/src/auth_client.dart | 7 ------- packages/supabase_auth/lib/src/helper.dart | 3 --- packages/supabase_flutter/lib/src/supabase.dart | 1 - packages/supabase_functions/lib/src/functions_client.dart | 1 - packages/supabase_storage/lib/src/fetch.dart | 3 --- packages/supabase_storage/lib/src/storage_client.dart | 3 --- 8 files changed, 24 deletions(-) diff --git a/packages/postgrest/lib/src/postgrest_filter_builder.dart b/packages/postgrest/lib/src/postgrest_filter_builder.dart index aa6001901..1f9490189 100644 --- a/packages/postgrest/lib/src/postgrest_filter_builder.dart +++ b/packages/postgrest/lib/src/postgrest_filter_builder.dart @@ -334,13 +334,11 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder { // keep it simple and accept a string url = _url.appendSearchParameters(column, 'cs.$value'); } else if (value is List) { - // array url = _url.appendSearchParameters( column, 'cs.{${_cleanFilterList(value)}}', ); } else { - // json url = _url.appendSearchParameters(column, 'cs.${json.encode(value)}'); } return copyWithUrl(url); @@ -379,13 +377,11 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder { // keep it simple and accept a string url = _url.appendSearchParameters(column, 'cd.$value'); } else if (value is List) { - // array url = _url.appendSearchParameters( column, 'cd.{${_cleanFilterList(value)}}', ); } else { - // json url = _url.appendSearchParameters(column, 'cd.${json.encode(value)}'); } return copyWithUrl(url); @@ -468,7 +464,6 @@ class PostgrestFilterBuilder extends PostgrestTransformBuilder { PostgrestFilterBuilder overlaps(String column, Object value) { final Uri url; if (value is List) { - // array url = _url.appendSearchParameters( column, 'ov.{${_cleanFilterList(value)}}', diff --git a/packages/postgrest/lib/src/postgrest_transform_builder.dart b/packages/postgrest/lib/src/postgrest_transform_builder.dart index 9237b8b4e..f9c3d1c49 100644 --- a/packages/postgrest/lib/src/postgrest_transform_builder.dart +++ b/packages/postgrest/lib/src/postgrest_transform_builder.dart @@ -330,7 +330,6 @@ class PostgrestTransformBuilder extends PostgrestBuilder { PostgrestTransformBuilder maxAffected(int value) { final newHeaders = {..._headers}; - // Add handling=strict and max-affected headers final existingPrefer = _emptyPreferAsNull(newHeaders['Prefer']); final String preferHeader; if (existingPrefer != null) { diff --git a/packages/supabase_auth/lib/src/auth_client.dart b/packages/supabase_auth/lib/src/auth_client.dart index 658c316f0..5b68b5055 100644 --- a/packages/supabase_auth/lib/src/auth_client.dart +++ b/packages/supabase_auth/lib/src/auth_client.dart @@ -1732,7 +1732,6 @@ class AuthClient { final startedAt = DateTime.now(); var attempt = 0; return await retry( - // Make a GET request () async { attempt++; authLogger.fine('Attempt $attempt to refresh token'); @@ -2148,7 +2147,6 @@ class AuthClient { } Future _fetchJwk(String kid, JWKSet suppliedJwks) async { - // try fetching from the supplied jwks final jwk = suppliedJwks.keys.firstWhereOrNull((key) => key.keyId == kid); if (jwk != null) { return jwk; @@ -2156,10 +2154,8 @@ class AuthClient { final now = DateTime.now(); - // try fetching from cache final cachedJwk = _jwks?.keys.firstWhereOrNull((key) => key.keyId == kid); - // jwks exists and it isn't stale if (cachedJwk != null && _jwksCachedAt != null && _jwksCachedAt!.add(AuthConstants.jwksTtl).isAfter(now)) { @@ -2183,7 +2179,6 @@ class AuthClient { _jwks = jwks; _jwksCachedAt = now; - // find the signing key return jwks.keys.firstWhereOrNull((key) => key.keyId == kid); } @@ -2223,10 +2218,8 @@ class AuthClient { token = session.accessToken; } - // Decode the JWT to get the payload final decoded = decodeJwt(token); - // Validate expiration unless allowExpired is true if (!(options?.allowExpired ?? false)) { validateExpiration(decoded.payload.expiresAt); } diff --git a/packages/supabase_auth/lib/src/helper.dart b/packages/supabase_auth/lib/src/helper.dart index b9c09f11c..a3d3cd0a3 100644 --- a/packages/supabase_auth/lib/src/helper.dart +++ b/packages/supabase_auth/lib/src/helper.dart @@ -23,15 +23,12 @@ DecodedJwt decodeJwt(String token) { final rawSignature = parts[2]; try { - // Decode header final headerJson = Base64Url.decodeToString(rawHeader); final header = JwtHeader.fromJson(json.decode(headerJson)); - // Decode payload final payloadJson = Base64Url.decodeToString(rawPayload); final payload = JwtPayload.fromJson(json.decode(payloadJson)); - // Decode signature final signature = Base64Url.decodeToBytes(rawSignature); return DecodedJwt( diff --git a/packages/supabase_flutter/lib/src/supabase.dart b/packages/supabase_flutter/lib/src/supabase.dart index eaaad2bfa..238ca630d 100644 --- a/packages/supabase_flutter/lib/src/supabase.dart +++ b/packages/supabase_flutter/lib/src/supabase.dart @@ -320,7 +320,6 @@ class Supabase { /// [captured] is the lifecycle state at the time the event was enqueued. /// If a newer event has arrived since, this one is skipped (stale). Future _processLifecycle(AppLifecycleState captured) async { - // Skip if a newer lifecycle event has superseded this one. if (captured != _targetLifecycleState) return; final realtime = Supabase.instance.client.realtime; diff --git a/packages/supabase_functions/lib/src/functions_client.dart b/packages/supabase_functions/lib/src/functions_client.dart index 6280c86bc..1fea44880 100644 --- a/packages/supabase_functions/lib/src/functions_client.dart +++ b/packages/supabase_functions/lib/src/functions_client.dart @@ -169,7 +169,6 @@ class FunctionsClient { }) async { final effectiveRegion = region ?? _region; - // Merge query parameters with forceFunctionRegion if region is specified final effectiveQueryParameters = { ...?queryParameters, if (effectiveRegion != null && effectiveRegion != 'any') diff --git a/packages/supabase_storage/lib/src/fetch.dart b/packages/supabase_storage/lib/src/fetch.dart index 6548cc1e2..c07186a9a 100644 --- a/packages/supabase_storage/lib/src/fetch.dart +++ b/packages/supabase_storage/lib/src/fetch.dart @@ -167,8 +167,6 @@ class Fetch { ) async { final headers = options?.headers ?? {}; - // Create a factory function that generates a fresh MultipartRequest for - // each attempt http.MultipartRequest createRequest() { final request = http.AbortableMultipartRequest( method.value, @@ -198,7 +196,6 @@ class Fetch { '${Uri.parse(url).redacted} ${headers.redacted}', ); - // Create a fresh request for each retry attempt return createRequest().sendWith(httpClient); }, options: retryOptions, diff --git a/packages/supabase_storage/lib/src/storage_client.dart b/packages/supabase_storage/lib/src/storage_client.dart index cd10181f0..fcb2fb908 100644 --- a/packages/supabase_storage/lib/src/storage_client.dart +++ b/packages/supabase_storage/lib/src/storage_client.dart @@ -97,11 +97,9 @@ class SupabaseStorageClient extends StorageBucketApi { final uri = Uri.parse(url); final hostname = uri.host; - // If it's a legacy storage URL, transform it const legacyStoragePrefix = '/storage'; if (_isLegacySupabaseHost(hostname) && uri.path.startsWith(legacyStoragePrefix)) { - // Remove /storage from pathname final newPath = uri.path.substring(legacyStoragePrefix.length); // Replace .supabase. with .storage.supabase. in hostname, on the same // label boundary the check above used. @@ -110,7 +108,6 @@ class SupabaseStorageClient extends StorageBucketApi { '.storage.supabase.', ); - // Reconstruct the URI return uri .replace( host: newHostname, From 40f8b9a519e66f97823c007a6fb3544a1775a9fc Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Thu, 17 Sep 2026 18:50:07 +0200 Subject: [PATCH 2/2] refactor: trim history narration and issue link from dartdocs Dartdocs describe current behavior; design history and tracking references belong in the PR/commit, not the doc comment. --- .../lib/src/shared_preferences_auth_async_storage.dart | 6 +++--- packages/supabase_realtime/lib/src/transformers.dart | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/supabase_flutter/lib/src/shared_preferences_auth_async_storage.dart b/packages/supabase_flutter/lib/src/shared_preferences_auth_async_storage.dart index e0fa8b98e..ce8ae0551 100644 --- a/packages/supabase_flutter/lib/src/shared_preferences_auth_async_storage.dart +++ b/packages/supabase_flutter/lib/src/shared_preferences_auth_async_storage.dart @@ -88,9 +88,9 @@ class SharedPreferencesAuthAsyncStorage extends AuthAsyncStorage { /// Reads [key] from `window.localStorage`. /// - /// Code verifiers used to be written through [SharedPreferencesAsync], which - /// on web JSON encodes the value under the very same key. Such a value is - /// decoded and written back as is, so the flow it belongs to can complete. + /// Some values are written through [SharedPreferencesAsync], which on web + /// JSON encodes the value under the very same key. Such a value is decoded + /// and written back as is, so the flow it belongs to can complete. String? _webItem(String key) { final value = web.getItem(key); if (value == null || !value.startsWith('"')) { diff --git a/packages/supabase_realtime/lib/src/transformers.dart b/packages/supabase_realtime/lib/src/transformers.dart index 60e38cce0..01c975006 100644 --- a/packages/supabase_realtime/lib/src/transformers.dart +++ b/packages/supabase_realtime/lib/src/transformers.dart @@ -514,7 +514,7 @@ class _ArrayLiteralParser { } /// Fixes timestamp to be ISO-8601. Swaps the space between the date and time -/// for a 'T' See https://github.com/supabase/supabase/issues/18 +/// for a 'T'. /// ///```dart /// @example toTimestampString('2019-09-10 00:00:00')