Note I'm not sure if this should be filed here.
I am looking to use a dart based grpc server. I have generated my protos and have trialled a go sample which works. But Im not having the same such luck. This doesn't occur when then server is not in a container class.
import 'package:testing_issue/src/server/grpc_server.dart';
import 'package:logging/logging.dart';
void main() async {
final _log = Logger('GRPC Server Test');
final port = 9091;
final server = GRPCServer();
await server.start();
_log.finest('Server listening on port: $port');
}
src/server/grpc_server.dart
import 'dart:io';
import 'package:grpc/grpc.dart';
import 'package:logging/logging.dart';
class GRPCServer {
static final _log = Logger('GRPCServer');
late final Server server;
late final int port;
GRPCServer({this.port = 9091}) {
server = Server([]);
}
Future<void> start() async {
// this works when run directly in main
await server.serve(
address: InternetAddress(
'localhost',
type: InternetAddressType.unix,
),
port: port,
);
}
}
Looks like a crash in the Dart front-end. Thanks for providing the repro! There is a similar issue already reported: https://github.com/dart-lang/sdk/issues/49641. Please follow there for updates.
Note I'm not sure if this should be filed here. I am looking to use a dart based grpc server. I have generated my protos and have trialled a go sample which works. But Im not having the same such luck. This doesn't occur when then server is not in a container class.
Repro steps
dart -v lib/main.dart
Expected result: server application to start
Actual result:
Details
main.dart
src/server/grpc_server.dart