createClientChannel function

void createClientChannel({
  1. required String domain,
})

Create the client channel

Implementation

void createClientChannel({required String domain}) {
  var uri = Uri.parse(domain);
  channel = ClientChannel(
    uri.host, // Use your IP address where the server is running
    port: uri.port,
    options: ChannelOptions(
      keepAlive: ClientKeepAliveOptions(
        pingInterval: Duration(seconds: 30),
        timeout: Duration(seconds: 10),
      ),
      credentials: uri.isScheme('https')
          ? const ChannelCredentials.secure()
          : const ChannelCredentials.insecure(),
    ),
  );
}