Skip to main content

Editors

FDC editors are data-aware Flutter controls. Each editor binds to a dataset and a field name, reads the current record, writes through the dataset edit buffer, and participates in the same validation and change-tracking lifecycle as the data grid.

FdcTextEdit(
dataSet: customers,
fieldName: 'company_name',
label: 'Company name',
)

You do not need to mirror dataset values into separate TextEditingController objects or manually copy form values back into the record.

Available editors

EditorTypical field typePurpose
FdcTextEditstring, GUIDSingle-line text
FdcMemoEditstringMultiline text
FdcIntegerEditintegerWhole-number input
FdcDecimalEditdecimalExact decimal input
FdcDateEditdateDate input and picker
FdcTimeEdittimeTime input and optional picker
FdcDateTimeEditdate-timeCombined date and time input
FdcBooleanEditbooleanCheckbox or switch
FdcComboEdit<T>supported scalar valuesSelection from predefined options

Dataset lifecycle

A bound editor works with the dataset state rather than owning an independent form model:

  1. the editor reads the current field value;
  2. user input moves the dataset into edit mode when needed;
  3. accepted values are written to the edit buffer;
  4. post() accepts the record edit;
  5. applyUpdates() persists pending cached changes when the dataset uses cached updates.

This means a grid and a form can stay synchronized by binding both to the same dataset.

Shared events

Editors can react to focus and value changes:

FdcTextEdit(
dataSet: customers,
fieldName: 'city',
onValueChanged: (event) {
debugPrint('City changed to ${event.value}');
},
)

Use field validation for business rules that belong to the data model. Use editor events for UI behavior and workflow reactions. Configure marker, inline, or hidden validation presentation through FdcErrorIndicatorOptions.

Lightweight import

Applications can use the main package barrel:

import 'package:flutter_data_components/fdc.dart';

Features that only need editor controls can use:

import 'package:flutter_data_components/fdc_edit.dart';