connect method

Future<void> connect({
  1. String host = 'localhost',
  2. int? port,
})

Connect to the gRPC server

Implementation

Future<void> connect({String host = 'localhost', int? port}) async {
  final serverPort = port ?? ServerProcessManager.instance.port;

  _channel = ClientChannel(
    host,
    port: serverPort,
    options: const ChannelOptions(
      credentials: ChannelCredentials.insecure(),
    ),
  );

  _client = LiteRtLmServiceClient(_channel!);

  debugPrint('[LiteRtLmClient] Connected to $host:$serverPort');
}