Skip to content

Commit a588d98

Browse files
committed
fix(server): resolve handler type ambiguity in entrypoint
Fixes a type error where `buildRootHandler()` was being inferred as `dynamic` instead of `Handler`. The fix explicitly casts the result to `Handler` before passing it to the `serve` function, resolving the static analysis error and ensuring type safety.
1 parent 38a3a5d commit a588d98

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bin/main.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ Future<void> main(List<String> args) async {
7373
// Start the server directly without the hot reload wrapper.
7474
final address = InternetAddress.anyIPv6;
7575
final port = int.tryParse(Platform.environment['PORT'] ?? '8080') ?? 8080;
76-
server = await serve(dart_frog.buildRootHandler(), address, port);
76+
77+
// Explicitly cast the handler to resolve the type ambiguity.
78+
final handler = dart_frog.buildRootHandler() as Handler;
79+
server = await serve(handler, address, port);
7780
log.info(
7881
'Server listening on http://${server.address.host}:${server.port}',
7982
);

0 commit comments

Comments
 (0)