executeCommand method

  1. @override
Future<String?> executeCommand(
  1. String atCommand, {
  2. bool auth = false,
})
override

Implementation

@override
// ignore: missing_return
Future<String?> executeCommand(String atCommand, {bool auth = false}) async {
  if (auth) {
    if (privateKey != null) {
      await authenticate(privateKey);
    } else if (cramSecret != null) {
      await authenticate_cram(cramSecret);
    } else {
      throw UnAuthenticatedException(
          'Unable to perform atlookup auth. Private key/cram secret is not set');
    }
  }
  try {
     await connection!.write(atCommand);
  } on Exception catch (e) {
    logger.severe('Exception in sending to server, ${e.toString()}');
    rethrow;
  }
}