Schema.fromBoolean constructor

Schema.fromBoolean(
  1. bool value, {
  2. List<String> jsonPath = const [],
})

Creates a schema from a boolean value.

A true value creates a schema that allows any value, while a false value creates a schema that allows no values.

Implementation

factory Schema.fromBoolean(bool value, {List<String> jsonPath = const []}) {
  return Schema.fromMap(value ? {} : {'not': {}});
}