encodeAttributeValue method Null safety

  1. @override
String encodeAttributeValue(
  1. String input,
  2. XmlAttributeType type
)
override

Encodes a string to be serialized as XML attribute value.

Implementation

@override
String encodeAttributeValue(String input, XmlAttributeType type) {
  switch (type) {
    case XmlAttributeType.SINGLE_QUOTE:
      return input.replaceAllMapped(
          _singeQuoteAttributePattern, _singeQuoteAttributeReplace);
    case XmlAttributeType.DOUBLE_QUOTE:
      return input.replaceAllMapped(
          _doubleQuoteAttributePattern, _doubleQuoteAttributeReplace);
  }
}