buildSimpleKey method
Creates a key from the given string.
This method preferably creates unquoted keys. If the key contains characters that are not allowed in unquoted keys, a quoted key is created instead. Whether a quoted key is a literal or basic string is determined by the rules of buildSinglelineString.
Implementation
TomlSimpleKey buildSimpleKey(dynamic key) {
key = unwrapKey(key);
if (key is String) {
if (TomlUnquotedKey.canEncode(key)) return TomlUnquotedKey(key);
return TomlQuotedKey(buildSinglelineString(key));
}
throw TomlUnknownKeyTypeException(key);
}