buildString method

TomlString buildString(
  1. String str, {
  2. bool allowMultiline = true,
})

Converts the given string to a TomlString.

If allowMultiline is set to true and the given string contains newlines, a multiline string is created (see buildMultilineString). Otherwise a singleline string is created (see buildSinglelineString).

In both cases a literal string is created preferably. A basic string is created only if the string contains characters that are not allowed in literal strings.

Implementation

TomlString buildString(String str, {bool allowMultiline = true}) {
  if (allowMultiline && isMultilineString(str)) {
    return buildMultilineString(str);
  }
  return buildSinglelineString(str);
}