boolean<C extends Component> static method

ComponentField<C> boolean<C extends Component>(
  1. String name, {
  2. required bool defaultValue,
  3. bool get(
    1. C component
    )?,
  4. void set(
    1. C component,
    2. bool value
    )?,
  5. String? doc,
  6. String? group,
  7. List<String> formerNames = const [],
  8. bool transient = false,
})

A boolean property.

Implementation

static ComponentField<C> boolean<C extends Component>(
  String name, {
  required bool defaultValue,
  bool Function(C component)? get,
  void Function(C component, bool value)? set,
  String? doc,
  String? group,
  List<String> formerNames = const [],
  bool transient = false,
}) => ComponentField(
  ComponentPropertyDef(
    name,
    ComponentPropertyKind.boolean,
    defaultValue: BoolValue(defaultValue),
    doc: doc,
    group: group,
    formerNames: formerNames,
    transient: transient,
  ),
  read: get == null ? null : (c, _) => BoolValue(get(c)),
  write: set == null
      ? null
      : (c, v, _) {
          if (v is BoolValue) set(c, v.value);
        },
);