在 Flutter 项目中使用 Grpc Web

Mor*_*ens 5 dart grpc flutter grpc-web grpc-dart

我希望有人可以帮助解决我目前正在创建一个适用于 Web 和移动设备的 Flutter 应用程序的问题,并且我想使用 GRPC 和 WebGrpc。使用 Grpc 一切都运行良好,但使用 Web Grpc 时出现错误

   if (kIsWeb) {
    print("flutter web");
    clientChannel =
        GrpcWebClientChannel.xhr(Uri.parse('http://192.168.2.146:8880'));
    AuthClient(clientChannel).authenticate(AuthenticationRequest()
      ..login = "Apfel"
      ..password= "Hello").then((res) => print(res)).catchError((err) => print(err));
  } else {
    print("flutter mobil");
    clientChannel = ClientChannel('192.168.2.146',
        port: 3009,
        options:
        ChannelOptions(credentials: ChannelCredentials.insecure()));
  }
Run Code Online (Sandbox Code Playgroud)

我收到以下错误预期为“ClientChannel”类型的值,但得到了“GrpcWebClientChannel”类型之一