Skip to main content

Navigation

FdcDataSet maintains a current record. Navigation changes that cursor within the active dataset view after filtering, sorting, and search are applied.

Move through records

dataSet.first();
dataSet.next();
dataSet.prior();
dataSet.last();

Move directly by visible record number:

dataSet.moveToRecord(25);

Record numbers are 1-based. The dataset uses -1 when there is no active record.

Inspect navigation state

final current = dataSet.recordNumber;
final count = dataSet.recordCount;
final beforeFirst = dataSet.bof;
final afterLast = dataSet.eof;

The current record belongs to the active view. A filter or search can therefore change both recordCount and the visible position of the current record without changing the underlying record identity.

Read current values

Use field accessors or dataset indexing for current-record values:

final name = dataSet.fieldByName('name').value;
final status = dataSet['status'];

For writes, first enter edit or insert state:

dataSet.edit();
dataSet['status'] = 'active';
dataSet.post();

Scroll callbacks

Use beforeScroll and afterScroll when application logic must react specifically to cursor movement:

final dataSet = FdcDataSet(
fields: fields,
afterScroll: (dataSet, previousRecordNumber, currentRecordNumber) {
// React to the new current record.
},
);

Navigation operations participate in the dataset edit lifecycle. Application code should not treat cursor movement as an unrelated UI concern: the dataset owns edit state, current-record state, and recordset transitions together.

For the full edit model, see Editing Lifecycle.