Skip to main content

Boolean editor

FdcBooleanEdit binds a boolean field to either a checkbox or a switch.

Boolean editor variants
Loading FDC sample…
Column(
children: [
FdcBooleanEdit(
dataSet: customers,
fieldName: 'active',
label: 'Active customer',
control: FdcBooleanControl.switchControl,
),
FdcBooleanEdit(
dataSet: customers,
fieldName: 'email_notifications',
label: 'Email notifications',
),
FdcBooleanEdit(
dataSet: customers,
fieldName: 'credit_approved',
label: 'Credit approved',
readOnly: true,
control: FdcBooleanControl.switchControl,
),
],
);

Checkbox

FdcBooleanEdit(
dataSet: customers,
fieldName: 'active',
label: 'Active',
)

Switch

FdcBooleanEdit(
dataSet: settings,
fieldName: 'email_notifications',
label: 'Email notifications',
control: FdcBooleanControl.switchControl,
)

Both control styles write through the normal dataset edit lifecycle.

Required boolean fields

When a boolean field is required, the editor participates in Flutter Form.validate() behavior. Use this when true is the only acceptable completed state, such as explicit confirmation or acceptance workflows.

Read-only state

FdcBooleanEdit(
dataSet: orders,
fieldName: 'invoiced',
readOnly: true,
)

Use a read-only editor when the value should remain visible in the form but is controlled by application logic.