FitGridController<T> class

The grid's state, in one place.

Hold one yourself to drive the grid programmatically — sort it, hide a column, read the selection — or let the grid create its own and forget it exists. Ownership follows the same rule as ScrollController: whoever constructs it disposes it.

There is no state-management opinion here on purpose. This is a ChangeNotifier cluster and nothing more, so it composes with bloc, riverpod, signals or plain setState without any of them being a dependency.

Constructors

FitGridController({List<T> rows = const [], List<FitGridColumn<T>> columns = const [], FitGridSelectionMode selectionMode = FitGridSelectionMode.none})

Properties

columns → FitGridColumnState<T>
Column order, visibility and widths.
final
data → FitGridDataState<T>
Rows and their ordering.
final
details → FitGridDetailState
Which rows have their detail panel open, when FitGrid.detailBuilder is set.
final
editing → FitGridEditingState
Which cell is open for editing, if any.
final
filter → FitGridFilterState<T>
The active search text and column filters.
final
focus → FitGridFocusState
Which cell the keyboard is on.
final
grouping → FitGridGroupingState<T>
Grouping levels, tree structure, and which of them are open.
final
hashCode → int
The hash code for this object.
no setterinherited
history → FitGridEditHistory
The user's edits, for undo and redo.
final
pagination → FitGridPaginationState
Which page is on screen. Inert until FitGrid.paginated is on, or FitGridPaginationState.enabled is set here.
final
range → FitGridCellRangeState
The selected rectangle of cells, when FitGrid.cellSelection is on.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selection → FitGridSelectionState
Selected rows, by index into the full row list — not the page.
final

Methods

attachViewport(void reveal(int rowIndex, String? columnId, double padding)?) → void
Wires the controller to a mounted grid so scrollTo has something to scroll. Called by FitGrid as it mounts and unmounts; a host never needs to call it.
clearSort() → void
Removes every sort key, returning the rows to their supplied order.
dispose() → void
export({bool selectedOnly = false, bool includeHeaders = true}) → FitGridExportData
The grid's contents in the shape an exporter wants.
moveColumnBefore(String movedId, String targetId) → void
Moves a column so that it sits where targetId is now.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redo() → bool
Reapplies the most recently undone edit.
restoreState(FitGridSavedState state) → void
Puts back a view saved by saveState.
saveState() → FitGridSavedState
A snapshot of the view — column layout, sort, filters, search and page — for the app to keep and hand back to restoreState later.
scrollTo(int rowIndex, {String? columnId, double padding = 0}) → void
Brings a row — and optionally a column — into view.
setSort(List<FitGridSortKey> keys) → void
Replaces the whole sort, highest priority first.
toggleSort(String columnId, {bool additive = false}) → void
Cycles the sort on a column: ascending, descending, unsorted.
toString() → String
A string representation of this object.
inherited
undo() → bool
Reverts the most recent edit — a typed value, a paste, a clear — by committing the previous values back through the columns' editors. Returns whether there was anything to undo.

Operators

operator ==(Object other) → bool
The equality operator.
inherited