encode static method

String? encode(
  1. String? value, {
  2. bool multiLine = false,
  3. bool pre = false,
  4. bool space = false,
  5. bool entity = false,
})

Encodes the string to a valid XML string.

  • value is the text to encode.
  • pre - whether to replace whitespace with  
  • space - whether to keep the space but still able to break lines. If pre is true, space is ignored.
  • multiLine - whether to replace linefeed with
  • entity - whether value might 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);