5

I hope someone can help with my issue I am creating at the moment an Flutter app for Web and Mobile and I want to use GRPC and WebGrpc. With Grpc Everything runs fine but with Web Grpc I got an error

   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()));
  }

I got the following error Expected a value of type 'ClientChannel', but got one of type 'GrpcWebClientChannel'

2
  • Did you find a solution to make it work for all the platforms? Commented Apr 6, 2021 at 11:39
  • This is the answer stackoverflow.com/questions/58710226/… Commented May 12, 2021 at 5:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.