buildCommand method

  1. @override
String buildCommand()
override

Build the @ command to be sent to remote secondary for execution.

Implementation

@override
String buildCommand() {
  String atKeyName = buildKey();
  if (isJson) {
    var updateParams = UpdateParams()
      ..atKey = atKeyName
      ..value = value
      ..sharedBy = atKey.sharedBy
      ..sharedWith = atKey.sharedWith
      ..metadata = atKey.metadata;
    var json = updateParams.toJson();
    var command = 'update:json:${jsonEncode(json)}\n';
    return command;
  } else {
    var metadataFragment = atKey.metadata.toAtProtocolFragment();
    var command = 'update$metadataFragment:$atKeyName $value\n';
    return command;
  }
}