normalizeXml function

String normalizeXml(
  1. String hashableXml
)

Implementation

String normalizeXml(String hashableXml) {
  return hashableXml
      .replaceAll('\r\n', '\n') // Normalize all line endings to \n
      .replaceAll(
        RegExp(r'\s+$', multiLine: true),
        '',
      ) // Remove trailing spaces per line
      .trim(); // Trim leading/trailing whitespace
}