isValidUnquotedKey function

bool isValidUnquotedKey(
  1. String key
)

Checks if a key can be used without quotes.

Valid unquoted keys must start with a letter or underscore, followed by letters, digits, underscores, or dots.

Implementation

bool isValidUnquotedKey(String key) {
  return RegExp(r'^[A-Z_][\w.]*$', caseSensitive: false).hasMatch(key);
}