from static method

XmlComment? from(
  1. String string,
  2. {bool trimWhitespace = true}
)
override

Parses a string for a XML comment.

If trimWhitespace is true, unnecessary whitespace between nodes will be removed and all remaining whitespace will be replaced with a single space. trimWhitespace must not be null.

Returns null if no comments are found.

Implementation

static XmlComment? from(
  String string, {
  bool trimWhitespace = true,
}) {
  if (trimWhitespace) string = string.trimWhitespace();
  final comment = Delimiters.comment.firstMatch(string);
  if (comment == null) return null;
  return XmlComment(comment.namedGroup('value')!);
}