encode static method
Encodes the string to a valid XML string.
valueis the text to encode.pre- whether to replace whitespace withspace- whether to keep the space but still able to break lines. Ifpreis true,spaceis ignored.multiLine- whether to replace linefeed withentity- whethervaluemight contain XML entities, such as‖and". If true, it won't encode it if an entity is found. If true, you can escape with a backslash, such as\&. So, it won't be treated as a XML entity. Note: backslash won't be handled specially if false. Default: false.
Implementation
static String? encode(String? value,
{bool multiLine = false, bool pre = false,
bool space = false, bool entity = false})
=> value == null ? value:
encodeNS(value, multiLine: multiLine, pre: pre, space: space, entity: entity);