Skip to content

Commit d9ba399

Browse files
Copilotexaby73
andauthored
Update Dart SDK constraint to >=3.8.0 <4.0.0 and configure trailing comma preservation (#60)
* Initial plan * Update Dart SDK constraint to ^3.8.3 in all pubspec.yaml and dpk.yaml files Co-authored-by: exaby73 <50555895+exaby73@users.noreply.github.com> * Apply automated fixes and format code for Dart 3.8.3 Co-authored-by: exaby73 <50555895+exaby73@users.noreply.github.com> * Change SDK constraint to >=3.8.0 <4.0.0 and add trailing_commas: preserve to formatters Co-authored-by: exaby73 <50555895+exaby73@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: exaby73 <50555895+exaby73@users.noreply.github.com>
1 parent 61c2044 commit d9ba399

File tree

74 files changed

+2373
-1654
lines changed

Some content is hidden

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

74 files changed

+2373
-1654
lines changed

analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
formatter:
2+
trailing_commas: preserve
3+
14
analyzer:
25
exclude:
36
- pub_packages/**

dpk.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ catalog:
55
issue_tracker: https://github.com/dartarcade/arcade/issues
66
repository: https://github.com/dartarcade/arcade/tree/main/DPK_PACKAGE_PATH
77
environment:
8-
sdk: ^3.5.0
8+
sdk: '>=3.8.0 <4.0.0'
99

1010
dependencies:
1111
luthor: ^0.14.0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
include: package:lint/strict.yaml
2+
3+
formatter:
4+
trailing_commas: preserve
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
include: package:lint/analysis_options.yaml
22

3+
formatter:
4+
trailing_commas: preserve
5+
36
linter:
47
rules:
58
avoid_print: false

packages/arcade/example/lib/app/controllers/example_controller.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ class ExampleController {
3939
final data = await context.formData();
4040
return switch (data) {
4141
BodyParseSuccess(value: final data) => data.files.first.path,
42-
BodyParseFailure(error: final e) => throw e as Object? ??
43-
const BadRequestException(message: 'Invalid input'),
42+
BodyParseFailure(error: final e) =>
43+
throw e as Object? ??
44+
const BadRequestException(message: 'Invalid input'),
4445
};
4546
}
4647

packages/arcade/example/lib/core/routes.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ void defineRoutes() {
5555
onConnect: exampleController.onWsConnect,
5656
)
5757
.after(
58-
(context, handleResult, id) {
59-
print('After websocket handler for $id');
60-
return (context, handleResult, id);
61-
},
62-
);
58+
(context, handleResult, id) {
59+
print('After websocket handler for $id');
60+
return (context, handleResult, id);
61+
},
62+
);
6363

6464
route.get('/any/*').handle((context) => 'Any route');
6565

@@ -73,7 +73,9 @@ void defineRoutes() {
7373
],
7474
defineRoutes: (route) {
7575
route().get('/').handle((context) => 'Group route');
76-
route().get('/hello/:name').handle(
76+
route()
77+
.get('/hello/:name')
78+
.handle(
7779
(context) =>
7880
'Group route with path parameter: ${context.pathParameters['name']}',
7981
);

packages/arcade/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repository: https://github.com/dartarcade/arcade/tree/main/packages/arcade/examp
55
publish_to: none
66

77
environment:
8-
sdk: ^3.5.0
8+
sdk: ">=3.8.0 <4.0.0"
99

1010
dependencies:
1111
arcade:

packages/arcade/lib/src/core/error_handler.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import 'dart:async';
22

33
import 'package:arcade/arcade.dart';
44

5-
typedef RouteErrorHandler<T extends RequestContext> = FutureOr<dynamic>
6-
Function(
7-
T context,
8-
ArcadeHttpException error,
9-
StackTrace stackTrace,
10-
);
5+
typedef RouteErrorHandler<T extends RequestContext> =
6+
FutureOr<dynamic> Function(
7+
T context,
8+
ArcadeHttpException error,
9+
StackTrace stackTrace,
10+
);
1111

1212
RouteErrorHandler? errorHandler;
1313

packages/arcade/lib/src/core/exceptions.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ class ArcadeHttpException {
1717
// 400
1818
class BadRequestException extends ArcadeHttpException {
1919
const BadRequestException({String? message, Map<String, dynamic>? errors})
20-
: super(message ?? 'Bad request', 400, errors: errors);
20+
: super(message ?? 'Bad request', 400, errors: errors);
2121
}
2222

2323
// 401
2424
class UnauthorizedException extends ArcadeHttpException {
2525
const UnauthorizedException({String? message, Map<String, dynamic>? errors})
26-
: super(message ?? 'Unauthorized', 401, errors: errors);
26+
: super(message ?? 'Unauthorized', 401, errors: errors);
2727
}
2828

2929
// 403
3030
class ForbiddenException extends ArcadeHttpException {
3131
const ForbiddenException({String? message, Map<String, dynamic>? errors})
32-
: super(message ?? 'Forbidden', 403, errors: errors);
32+
: super(message ?? 'Forbidden', 403, errors: errors);
3333
}
3434

3535
// 404
3636
class NotFoundException extends ArcadeHttpException {
3737
const NotFoundException({String? message, Map<String, dynamic>? errors})
38-
: super(message ?? 'Not found', 404, errors: errors);
38+
: super(message ?? 'Not found', 404, errors: errors);
3939
}
4040

4141
// 405
@@ -49,13 +49,13 @@ class MethodNotAllowedException extends ArcadeHttpException {
4949
// 409
5050
class ConflictException extends ArcadeHttpException {
5151
const ConflictException({String? message, Map<String, dynamic>? errors})
52-
: super(message ?? 'Conflict', 409, errors: errors);
52+
: super(message ?? 'Conflict', 409, errors: errors);
5353
}
5454

5555
// 418
5656
class ImATeapotException extends ArcadeHttpException {
5757
const ImATeapotException({String? message, Map<String, dynamic>? errors})
58-
: super(message ?? "I'm a teapot", 418, errors: errors);
58+
: super(message ?? "I'm a teapot", 418, errors: errors);
5959
}
6060

6161
// 422

packages/arcade/lib/src/core/hooks.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@ import 'dart:async';
22

33
import 'package:arcade/src/http/request_context.dart';
44

5-
typedef BeforeHookHandler<T extends RequestContext, U extends RequestContext>
6-
= FutureOr<U> Function(T context);
5+
typedef BeforeHookHandler<T extends RequestContext, U extends RequestContext> =
6+
FutureOr<U> Function(T context);
77

8-
typedef AfterHookHandler<T extends RequestContext, U extends RequestContext, V,
9-
W>
10-
= FutureOr<(U, W)> Function(T context, V handleResult);
8+
typedef AfterHookHandler<
9+
T extends RequestContext,
10+
U extends RequestContext,
11+
V,
12+
W
13+
> = FutureOr<(U, W)> Function(T context, V handleResult);
1114

12-
typedef AfterWebSocketHookHandler<T extends RequestContext,
13-
U extends RequestContext, V, W>
14-
= FutureOr<(U, W, String)> Function(T context, V handleResult, String id);
15+
typedef AfterWebSocketHookHandler<
16+
T extends RequestContext,
17+
U extends RequestContext,
18+
V,
19+
W
20+
> = FutureOr<(U, W, String)> Function(T context, V handleResult, String id);

0 commit comments

Comments
 (0)