propertyNames property

StringSchema? get propertyNames

A list of valid patterns for all property names.

For example, to define a schema where all property names must start with a lowercase letter:

final schema = ObjectSchema(
  propertyNames: Schema.string(pattern: r'^[a-z].*$'),
);

In this schema, an object like {'name': 'John', 'age': 30} would be valid, but {'Name': 'John', 'Age': 30} would be invalid because the property names do not start with a lowercase letter.

Implementation

StringSchema? get propertyNames =>
    (_value['propertyNames'] as Map?)?.cast<String, Object?>()
        as StringSchema?;