Skip to content

Commit 7099f3d

Browse files
authored
chore(celest_auth): Update linter/style preferences (#403)
- Ensures `celest_lints` is used - Applies latest linter/style preferences using `dart fix` - Re-formats using Dart 3.8
1 parent 39e15d9 commit 7099f3d

27 files changed

+798
-734
lines changed

.github/workflows/celest_auth.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Flutter
2929
uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # 2.19.0
3030
with:
31-
channel: stable
31+
channel: beta
3232
cache: true
3333
- name: Get Packages
3434
working-directory: packages/celest_auth
@@ -42,7 +42,7 @@ jobs:
4242
run: dart analyze --fatal-infos --fatal-warnings
4343
- name: Format
4444
working-directory: packages/celest_auth
45-
run: dart format --set-exit-if-changed .
45+
run: dart format --language-version=latest --set-exit-if-changed .
4646
# - name: Test
4747
# working-directory: packages/celest_auth
4848
# run: dart test

packages/celest_auth/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## NEXT
2+
3+
- chore: Re-format with Dart 3.8
4+
- chore: Update linter/style preferences
5+
16
## 1.0.2
27

38
- chore: Make close part of the public API (#267)

packages/celest_auth/example/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:flutter_lints/flutter.yaml
1+
include: package:celest_lints/app.yaml
22

33
analyzer:
44
plugins:

packages/celest_auth/example/celest/client/lib/celest_auth_example_client.dart

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ enum CelestEnvironment {
2626
local;
2727

2828
Uri get baseUri => switch (this) {
29-
local => _$celest.kIsWeb || !Platform.isAndroid
30-
? Uri.parse('http://localhost:7777')
31-
: Uri.parse('http://10.0.2.2:7777'),
32-
};
29+
local =>
30+
_$celest.kIsWeb || !Platform.isAndroid
31+
? Uri.parse('http://localhost:7777')
32+
: Uri.parse('http://10.0.2.2:7777'),
33+
};
3334
}
3435

3536
class Celest with _$celest.CelestBase {
@@ -41,22 +42,21 @@ class Celest with _$celest.CelestBase {
4142
_$native_storage_native_storage.NativeStorage(scope: 'celest');
4243

4344
@override
44-
late _$http_http.Client httpClient =
45-
_$celest.CelestHttpClient(secureStorage: nativeStorage.secure);
45+
late _$http_http.Client httpClient = _$celest.CelestHttpClient(
46+
secureStorage: nativeStorage.secure,
47+
);
4648

4749
late Uri _baseUri;
4850

4951
final _functions = CelestFunctions();
5052

51-
late CelestAuth _auth = CelestAuth(
52-
this,
53-
storage: nativeStorage,
54-
);
53+
late CelestAuth _auth = CelestAuth(this, storage: nativeStorage);
5554

5655
T _checkInitialized<T>(T Function() value) {
5756
if (!_initialized) {
5857
throw StateError(
59-
'Celest has not been initialized. Make sure to call `celest.init()` at the start of your `main` method.');
58+
'Celest has not been initialized. Make sure to call `celest.init()` at the start of your `main` method.',
59+
);
6060
}
6161
return value();
6262
}
@@ -87,10 +87,7 @@ class Celest with _$celest.CelestBase {
8787

8888
void _reset() {
8989
_auth.close().ignore();
90-
_auth = CelestAuth(
91-
this,
92-
storage: nativeStorage,
93-
);
90+
_auth = CelestAuth(this, storage: nativeStorage);
9491
_initialized = false;
9592
}
9693
}

packages/celest_auth/example/celest/client/lib/src/auth.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ extension type CelestAuth._(_$celest.AuthImpl _hub) implements _$celest.Auth {
1414
CelestAuth(
1515
_$celest.CelestBase celest, {
1616
required _$native_storage_native_storage.NativeStorage storage,
17-
}) : _hub = _$celest.AuthImpl(
18-
celest,
19-
storage: storage,
20-
);
17+
}) : _hub = _$celest.AuthImpl(celest, storage: storage);
2118

2219
_$celest.Email get email => _$celest.Email(_hub);
2320
}

packages/celest_auth/example/celest/client/lib/src/functions.dart

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ class CelestFunctions {
1919
}
2020

2121
class CelestFunctionsGreeting {
22-
Never _throwError({
23-
int? code,
24-
required Map<String, Object?> body,
25-
}) {
22+
Never _throwError({int? code, required Map<String, Object?> body}) {
2623
final status = body['@status'] as Map<String, Object?>?;
2724
final message = status?['message'] as String?;
2825
final details = status?['details'] as _$celest.JsonList?;
@@ -32,27 +29,28 @@ class CelestFunctionsGreeting {
3229
final errorDetails as Map<String, Object?>,
3330
{
3431
'@type': 'dart.core.StackTrace',
35-
'value': final stackTraceValue as String
32+
'value': final stackTraceValue as String,
3633
},
37-
...
34+
...,
3835
] =>
3936
(
4037
errorDetails['@type'],
4138
errorDetails['value'],
4239
StackTrace.fromString(stackTraceValue),
4340
),
4441
[final errorDetails as Map<String, Object?>, ...] => (
45-
errorDetails['@type'],
46-
errorDetails['value'],
47-
StackTrace.empty,
48-
),
42+
errorDetails['@type'],
43+
errorDetails['value'],
44+
StackTrace.empty,
45+
),
4946
};
5047

5148
switch (errorType) {
5249
case 'celest.core.v1.CloudException':
5350
Error.throwWithStackTrace(
54-
_$celest.Serializers.instance
55-
.deserialize<_$celest.CloudException>(errorValue),
51+
_$celest.Serializers.instance.deserialize<_$celest.CloudException>(
52+
errorValue,
53+
),
5654
stackTrace,
5755
);
5856
case 'celest.core.v1.CancelledException':
@@ -63,8 +61,9 @@ class CelestFunctionsGreeting {
6361
);
6462
case 'celest.core.v1.UnknownError':
6563
Error.throwWithStackTrace(
66-
_$celest.Serializers.instance
67-
.deserialize<_$celest.UnknownError>(errorValue),
64+
_$celest.Serializers.instance.deserialize<_$celest.UnknownError>(
65+
errorValue,
66+
),
6867
stackTrace,
6968
);
7069
case 'celest.core.v1.BadRequestException':
@@ -81,8 +80,9 @@ class CelestFunctionsGreeting {
8180
);
8281
case 'celest.core.v1.NotFoundException':
8382
Error.throwWithStackTrace(
84-
_$celest.Serializers.instance
85-
.deserialize<_$celest.NotFoundException>(errorValue),
83+
_$celest.Serializers.instance.deserialize<_$celest.NotFoundException>(
84+
errorValue,
85+
),
8686
stackTrace,
8787
);
8888
case 'celest.core.v1.AlreadyExistsException':
@@ -111,8 +111,9 @@ class CelestFunctionsGreeting {
111111
);
112112
case 'celest.core.v1.AbortedException':
113113
Error.throwWithStackTrace(
114-
_$celest.Serializers.instance
115-
.deserialize<_$celest.AbortedException>(errorValue),
114+
_$celest.Serializers.instance.deserialize<_$celest.AbortedException>(
115+
errorValue,
116+
),
116117
stackTrace,
117118
);
118119
case 'celest.core.v1.OutOfRangeException':
@@ -135,14 +136,16 @@ class CelestFunctionsGreeting {
135136
);
136137
case 'celest.core.v1.UnavailableError':
137138
Error.throwWithStackTrace(
138-
_$celest.Serializers.instance
139-
.deserialize<_$celest.UnavailableError>(errorValue),
139+
_$celest.Serializers.instance.deserialize<_$celest.UnavailableError>(
140+
errorValue,
141+
),
140142
stackTrace,
141143
);
142144
case 'celest.core.v1.DataLossError':
143145
Error.throwWithStackTrace(
144-
_$celest.Serializers.instance
145-
.deserialize<_$celest.DataLossError>(errorValue),
146+
_$celest.Serializers.instance.deserialize<_$celest.DataLossError>(
147+
errorValue,
148+
),
146149
stackTrace,
147150
);
148151
case 'celest.core.v1.DeadlineExceededError':
@@ -189,14 +192,16 @@ class CelestFunctionsGreeting {
189192
);
190193
case 'dart.core.UnsupportedError':
191194
Error.throwWithStackTrace(
192-
_$celest.Serializers.instance
193-
.deserialize<UnsupportedError>(errorValue),
195+
_$celest.Serializers.instance.deserialize<UnsupportedError>(
196+
errorValue,
197+
),
194198
stackTrace,
195199
);
196200
case 'dart.core.UnimplementedError':
197201
Error.throwWithStackTrace(
198-
_$celest.Serializers.instance
199-
.deserialize<UnimplementedError>(errorValue),
202+
_$celest.Serializers.instance.deserialize<UnimplementedError>(
203+
errorValue,
204+
),
200205
stackTrace,
201206
);
202207
case 'dart.core.StateError':
@@ -212,14 +217,16 @@ class CelestFunctionsGreeting {
212217
);
213218
case 'dart.core.OutOfMemoryError':
214219
Error.throwWithStackTrace(
215-
_$celest.Serializers.instance
216-
.deserialize<OutOfMemoryError>(errorValue),
220+
_$celest.Serializers.instance.deserialize<OutOfMemoryError>(
221+
errorValue,
222+
),
217223
stackTrace,
218224
);
219225
case 'dart.core.StackOverflowError':
220226
Error.throwWithStackTrace(
221-
_$celest.Serializers.instance
222-
.deserialize<StackOverflowError>(errorValue),
227+
_$celest.Serializers.instance.deserialize<StackOverflowError>(
228+
errorValue,
229+
),
223230
stackTrace,
224231
);
225232
case 'dart.core.Exception':
@@ -229,8 +236,9 @@ class CelestFunctionsGreeting {
229236
);
230237
case 'dart.core.FormatException':
231238
Error.throwWithStackTrace(
232-
_$celest.Serializers.instance
233-
.deserialize<FormatException>(errorValue),
239+
_$celest.Serializers.instance.deserialize<FormatException>(
240+
errorValue,
241+
),
234242
stackTrace,
235243
);
236244
case 'dart.core.IntegerDivisionByZeroException':
@@ -246,14 +254,16 @@ class CelestFunctionsGreeting {
246254
);
247255
case 'dart.async.TimeoutException':
248256
Error.throwWithStackTrace(
249-
_$celest.Serializers.instance
250-
.deserialize<TimeoutException>(errorValue),
257+
_$celest.Serializers.instance.deserialize<TimeoutException>(
258+
errorValue,
259+
),
251260
stackTrace,
252261
);
253262
case 'dart.convert.JsonUnsupportedObjectError':
254263
Error.throwWithStackTrace(
255-
_$celest.Serializers.instance
256-
.deserialize<JsonUnsupportedObjectError>(errorValue),
264+
_$celest.Serializers.instance.deserialize<JsonUnsupportedObjectError>(
265+
errorValue,
266+
),
257267
stackTrace,
258268
);
259269
default:
@@ -269,10 +279,7 @@ class CelestFunctionsGreeting {
269279
}
270280

271281
/// Says hello to the authenticated [user].
272-
@_$celest.CloudFunction(
273-
api: 'greeting',
274-
function: 'sayHello',
275-
)
282+
@_$celest.CloudFunction(api: 'greeting', function: 'sayHello')
276283
Future<String> sayHello() async {
277284
final $response = await celest.httpClient.post(
278285
celest.baseUri.resolve('/greeting/say-hello'),

0 commit comments

Comments
 (0)