FdcDataSet class

Flutter-friendly in-memory dataset with typed schema metadata, edit lifecycle management, validation, filtering, sorting and cached updates.

FdcDataSet extends ChangeNotifier, so low-level Flutter UI code may use addListener / removeListener for coarse-grained repaint notifications. Business logic should prefer the typed lifecycle callbacks such as beforePost, afterPost, onFieldChanged, onValidationError and onError, because a plain listener does not describe what changed.

Inheritance

Constructors

FdcDataSet({List<FdcFieldDef> fields = const <FdcFieldDef>[], IFdcDataAdapter? adapter, FdcUpdateMode updateMode = FdcUpdateMode.immediate, FdcRecordValidator? recordValidator, FdcDataSetBeforeOpen? beforeOpen, FdcDataSetAfterOpen? afterOpen, FdcDataSetBeforeClose? beforeClose, FdcDataSetAfterClose? afterClose, FdcDataSetBeforeEdit? beforeEdit, FdcDataSetAfterEdit? afterEdit, FdcDataSetBeforeInsert? beforeInsert, FdcDataSetAfterInsert? afterInsert, FdcDataSetBeforePost? beforePost, FdcDataSetAfterPost? afterPost, FdcDataSetBeforeDelete? beforeDelete, FdcDataSetAfterDelete? afterDelete, FdcDataSetBeforeCancel? beforeCancel, FdcDataSetAfterCancel? afterCancel, FdcDataSetStateChanged? onStateChanged, FdcDataSetValidationError? onValidationError, FdcDataSetErrorEvent? onError, FdcDataSetWorkStarted? onWorkStarted, FdcDataSetWorkCompleted? onWorkCompleted, FdcDataSetWorkError? onWorkError, FdcDataSetFieldChanged? onFieldChanged, FdcDataSetNewRecord? onNewRecord, FdcDataSetBeforeScroll? beforeScroll, FdcDataSetAfterScroll? afterScroll, FdcDataSetOperationOptions operationOptions = const FdcDataSetOperationOptions(), FdcDataPagingOptions paging = const FdcDataPagingOptions.disabled(), FdcFormatSettings? formatSettings, FdcValidationTranslations validationTranslations = const FdcValidationTranslations()})
Creates a dataset.

Properties

adapter IFdcDataAdapter?
Adapter configured for this dataset, or null for a local in-memory dataset.
no setter
aggregates FdcDataSetAggregatesApi
Aggregate calculation API.
latefinal
bof bool
True when the dataset cursor is positioned on the first visible record. Empty datasets are both BOF and EOF.
no setter
bookmarks FdcDataSetBookmarksApi
Transient record bookmark API.
latefinal
changeSet FdcChangeSet
Builds and returns a fresh snapshot of pending inserted, updated, and deleted records.
no setter
controlsDisableCount int
Number of unmatched disableControls calls.
no setter
controlsDisabled bool
Whether notifications to data-aware controls are currently suspended.
no setter
eof bool
True after navigation reaches or lands on the end of the dataset.
no setter
errors FdcDataSetErrorsApi
Dataset error-message API.
latefinal
fieldCount int
Number of fields defined by this dataset schema.
no setter
fieldNames List<String>
Unmodifiable schema field-name list in field-index order.
no setter
fields List<FdcFieldDef>
Unmodifiable schema definition list used by this dataset.
no setter
filter FdcDataSetFilters
Controls the dataset's single active filter and filtered view.
latefinal
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
hasUpdates bool
True when the dataset contains pending persistent changes.
no setter
isEmpty bool
Whether this object contains no items.
no setter
isLocal bool
True when this dataset owns its rows directly instead of using an adapter.
no setter
isOpen bool
True when the dataset is in any state other than FdcDataSetState.closed.
no setter
paging FdcDataSetPagingApi
Paging state and page/chunk navigation API.
latefinal
recordCount int
Number of records currently visible/navigable in the dataset view.
no setter
recordNumber int
1-based number of the current visible record/cursor position.
no setter
restoresCurrentRecordOnEnable bool
Whether the current controls suspension will restore its saved record.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
Controls the dataset's active global search definition.
latefinal
selection FdcDataSetSelectionApi
Row-selection state and operations API.
latefinal
sort FdcDataSetSorts
Controls the dataset's active sort definition and sorted view.
latefinal
state FdcDataSetState
Live dataset lifecycle state observed at the time of access.
no setter
updateMode FdcUpdateMode
Dataset persistence/apply semantics selected at construction time.
no setter
work FdcDataSetWork
Observable dataset work/progress state.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
append() → void
Starts inserting a new record at the logical end of the current view.
applyUpdates() Future<FdcDataApplyResult>
Applies the current persistent changeSet through the configured adapter.
cancel() → void
Cancels the current operation or edit state.
cancelUpdates() → void
Reverts all unapplied cached inserts, edits, and deletes.
close() → void
Closes the dataset or data source.
delete() → void
Deletes the current record.
disableControls({bool restoreCurrentRecord = false}) → void
Suspends notifications to data-aware controls.
dispose() → void
Discards any resources used by the object.
override
edit() → void
Starts editing the current record.
enableControls() → void
Resumes notifications to data-aware controls.
fieldByName(String fieldName) FdcField
Returns the schema definition for fieldName, using case-insensitive lookup.
fieldDef<T extends FdcFieldDef>(String fieldName) → T
Returns the schema/metadata definition for fieldName as T.
fieldIndex(String fieldName) int
Returns the zero-based schema index of fieldName.
fieldValue(String fieldName) Object?
Returns the current value of fieldName.
first() → void
Moves the cursor to the first visible record.
hasField(String fieldName) bool
Whether the schema contains fieldName, using case-insensitive lookup.
insert() → void
Inserts a new record.
last() → void
Moves the cursor to the last visible record.
loadRows(FutureOr<List<Map<String, Object?>>> rows) Future<void>
Replaces the contents of a local, adapter-less dataset.
moveToRecord(int recordNumber) → void
Moves to the visible record identified by its 1-based recordNumber.
next() → void
Moves the cursor to the next visible record.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
override
open({FdcDataLoadRequest request = const FdcDataLoadRequest()}) Future<void>
Opens the dataset asynchronously.
post() → void
Posts the current edit buffer.
prior() → void
Moves the cursor to the previous visible record.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setFieldValue(String fieldName, Object? value) → void
Sets a field value on the current edit/insert record.
toMaps({bool includeDeleted = false, bool includeNonPersistent = false}) List<Map<String, Object?>>
Materializes dataset records as field-name maps.
toString() String
A string representation of this object.
inherited
validateFieldValue(String fieldName, Object? value) List<FdcValidationError>
Validates value against the schema and validators of fieldName.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String fieldName) Object?
Returns the current value for fieldName.
operator []=(String fieldName, Object? value) → void
Sets the current edit/insert buffer value for fieldName.