Skip to content

Commit 639519d

Browse files
committed
chore: bump minimum Dart SDK to 3.9.0
Raise the minimum Dart SDK of the pure-Dart packages (and the supabase web example) from 3.4.0/3.3.0 to 3.9.0, matching supabase_flutter. Bumping the language version switches `dart format` to its mandatory "tall" style, so all affected packages are reformatted accordingly. The higher language version also surfaces two things the old style hid: - postgrest no longer implicitly promotes the bare `body as dynamic;` statement, so the casts in `_parseResponse` are made explicit (`body as Iterable` / `body as Map`). - the formatter wraps a long single-line `if` in realtime_client onto two lines, so it now needs braces (curly_braces_in_flow_control_structures).
1 parent ae930ea commit 639519d

118 files changed

Lines changed: 4947 additions & 3628 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/functions_client/lib/src/functions_client.dart

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ class FunctionsClient {
2525
http.Client? httpClient,
2626
YAJsonIsolate? isolate,
2727
String? region,
28-
}) : _url = url,
29-
_headers = {...Constants.defaultHeaders, ...headers},
30-
_isolate = isolate ?? (YAJsonIsolate()..initialize()),
31-
_hasCustomIsolate = isolate != null,
32-
_httpClient = httpClient,
33-
_region = region {
28+
}) : _url = url,
29+
_headers = {...Constants.defaultHeaders, ...headers},
30+
_isolate = isolate ?? (YAJsonIsolate()..initialize()),
31+
_hasCustomIsolate = isolate != null,
32+
_httpClient = httpClient,
33+
_region = region {
3434
_log.config(
35-
"Initialize FunctionsClient v$version with url '$url' and region '$region'");
35+
"Initialize FunctionsClient v$version with url '$url' and region '$region'",
36+
);
3637
_log.finest("Initialize with headers: $headers");
3738
}
3839

@@ -107,8 +108,10 @@ class FunctionsClient {
107108
};
108109

109110
final uri = Uri.parse('$_url/$functionName').replace(
110-
queryParameters:
111-
effectiveQueryParams.isNotEmpty ? effectiveQueryParams : null);
111+
queryParameters: effectiveQueryParams.isNotEmpty
112+
? effectiveQueryParams
113+
: null,
114+
);
112115

113116
final finalHeaders = <String, String>{
114117
..._headers,
@@ -159,12 +162,13 @@ class FunctionsClient {
159162
_log.finest('Request: ${request.method} ${request.url} ${request.headers}');
160163

161164
final response = await (_httpClient?.send(request) ?? request.send());
162-
final responseType = (response.headers['Content-Type'] ??
163-
response.headers['content-type'] ??
164-
'text/plain')
165-
.split(';')[0]
166-
.trim()
167-
.toLowerCase();
165+
final responseType =
166+
(response.headers['Content-Type'] ??
167+
response.headers['content-type'] ??
168+
'text/plain')
169+
.split(';')[0]
170+
.trim()
171+
.toLowerCase();
168172

169173
final isSuccessStatus =
170174
200 <= response.statusCode && response.statusCode < 300;

packages/functions_client/lib/src/types.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ class FunctionException implements Exception {
3131
final dynamic details;
3232
final String? reasonPhrase;
3333

34-
const FunctionException(
35-
{required this.status, this.details, this.reasonPhrase});
34+
const FunctionException({
35+
required this.status,
36+
this.details,
37+
this.reasonPhrase,
38+
});
3639

3740
@override
3841
String toString() =>

packages/functions_client/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/fun
66
documentation: 'https://supabase.com/docs/reference/dart/functions-invoke'
77

88
environment:
9-
sdk: '>=3.4.0 <4.0.0'
9+
sdk: '>=3.9.0 <4.0.0'
1010

1111
dependencies:
1212
http: ^1.2.2

packages/functions_client/test/custom_http_client.dart

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ class CustomHttpClient extends BaseClient {
3939
);
4040
} else if (request.url.path.endsWith('sse')) {
4141
return StreamedResponse(
42-
Stream.fromIterable(['a', 'b', 'c'].map((e) => utf8.encode(e))), 200,
43-
request: request,
44-
headers: {
45-
"Content-Type": "text/event-stream",
46-
});
42+
Stream.fromIterable(['a', 'b', 'c'].map((e) => utf8.encode(e))),
43+
200,
44+
request: request,
45+
headers: {
46+
"Content-Type": "text/event-stream",
47+
},
48+
);
4749
} else if (request.url.path.endsWith('binary')) {
4850
return StreamedResponse(
4951
Stream.value([1, 2, 3, 4, 5]),
@@ -105,13 +107,15 @@ class CustomHttpClient extends BaseClient {
105107

106108
if (request is MultipartRequest) {
107109
stream = Stream.value(
108-
utf8.encode(jsonEncode([
109-
for (final file in request.files)
110-
{
111-
"name": file.field,
112-
"content": await file.finalize().bytesToString()
113-
}
114-
])),
110+
utf8.encode(
111+
jsonEncode([
112+
for (final file in request.files)
113+
{
114+
"name": file.field,
115+
"content": await file.finalize().bytesToString(),
116+
},
117+
]),
118+
),
115119
);
116120
headers = {"Content-Type": "application/json"};
117121
} else {

0 commit comments

Comments
 (0)