grpc-dart version: 3.2.4
## Repro steps
I've a remote grpc server and grpc-web-proxy which is listening http://localhost:8090. Everything work fine when I use
```
GrpcWebClientChannel.xhr(
Uri.parse('http://localhost:8090'),
)
```
But when I use
```
GrpcOrGrpcWebClientChannel.grpc(
'localhost',
port: 8090,
options: ChannelOptions(credentials: ChannelCredentials.insecure()),
)
```
it always throws `Unsupported operation: not supported by gRPC-web`.
The problem in `grpc_or_grpcweb_channel_web.dart` file. There's a typo inside constructor:
```
GrpcOrGrpcWebClientChannelInternal.grpc(
Object host, {
required int port,
required ChannelOptions options,
}) : super.xhr(
Uri(
host: host.toString(),
port: port,
scheme: options.credentials.isSecure ? 'https' : 'http'),
) {
// Do not silently ignore options as caller may expect them to have effects.
throw UnsupportedError('not supported by gRPC-web');
}
Explanation:
super.xhr calls GrpcWebClientChannel.xhr constructor which has 2 parameters: GrpcWebClientChannel.xhr(Uri uri, {void Function()? channelShutdownHandler}).
I think 'the throw UnsupportedError('not supported by gRPC-web')' has been added with the intention to add channelShutdownHandler. But instead it's always called after constructor so UnsupportedError is always thrown.
```
The solution:
```
GrpcOrGrpcWebClientChannelInternal.grpc(
Object host, {
required int port,
required ChannelOptions options,
}) : super.xhr(
Uri(
host: host.toString(),
port: port,
scheme: options.credentials.isSecure ? 'https' : 'http',
),
channelShutdownHandler: () {
// Do not silently ignore options as caller may expect them to have effects.
throw UnsupportedError('not supported by gRPC-web');
}
);
```