data_grid library

Classes

CellLayoutId
Identifies a single cell in the grid by its row and column indices.
CellScope<T extends DataGridRow>
Scoped inherited widget that provides per-cell data to descendant widgets.
ClearCellSelectionEvent
Clears the focused-cells path entirely.
ClearFilterEvent
Clears the filter on a specific column, or all filters if columnId is null.
ClearSelectionEvent
Clears all row and cell selections.
ColumnFilter
A single column filter with an operator and comparison value.
ColumnReorderEvent
Moves a column from oldIndex to newIndex.
ColumnResizeEvent
Resizes a column to the specified width.
CopyCellsEvent
Copies the values of all focused cells to the system clipboard as TSV. Cells are sorted by display-order row, then by column index. Returns null — no state change, side-effect only.
CustomLayoutGridBody<T extends DataGridRow>
DataGrid<T extends DataGridRow>
A high-performance, virtualized data grid widget for displaying tabular data.
DataGridBorders
Border settings for DataGrid elements.
DataGridCell<T extends DataGridRow>
Cell widget whose content is always a stable widget instance wrapped in CellScope. The child widget (either DataGridColumn.cellWidget or the built-in _DefaultTextCell) is created once and never changes identity, so Flutter preserves the entire element subtree across rebuilds.
DataGridCellDecorations
Pre-computed BoxDecoration instances for all common cell variants. Avoids allocating new decorations on every cell build.
DataGridColors
Color settings for DataGrid elements.
DataGridColumn<T extends DataGridRow>
Configuration for a column in the DataGrid.
DataGridController<T extends DataGridRow>
Controller for managing DataGrid state, data, and events.
DataGridControllerScope<T extends DataGridRow>
Provides the controller and scroll controller. These rarely change, so widgets depending only on this won't rebuild on state updates.
DataGridDimensions
Dimension settings for DataGrid layout.
DataGridEvent
Base class for all data grid events.
DataGridHeader<T extends DataGridRow>
DataGridHeaderCell
A single header cell widget that displays column title and handles sorting/resizing. Supports:
DataGridInherited<T extends DataGridRow>
Convenience wrapper that nests both scopes.
DataGridInterceptor<T extends DataGridRow>
Base class for DataGrid interceptors.
DataGridLoadingOverlay
Default loading overlay widget displayed during heavy operations.
DataGridLoadingScope<T extends DataGridRow>
Scoped loading overlay that only rebuilds when loading state changes.
DataGridOverlayTheme
Theme settings for loading overlays in DataGrid.
DataGridPadding
Padding settings for DataGrid elements.
DataGridPagination<T extends DataGridRow>
DataGridRow
Base class for rows displayed in a DataGrid.
DataGridState<T extends DataGridRow>
Immutable snapshot of the entire data grid state.
DataGridStateScope<T extends DataGridRow>
Provides grid state via InheritedModel so dependents can subscribe to specific DataGridAspects and skip rebuilds for unrelated changes.
DataGridTheme
An inherited widget that provides DataGridThemeData to descendant widgets.
DataGridThemeData
Theme configuration for customizing the appearance of a DataGrid.
DefaultFilterWidget
Default filter widget using a simple debounced text input.
DeleteRowEvent
Deletes a single row by its ID.
DeleteRowsEvent
Deletes multiple rows by their IDs.
EditState
Inline cell editing state.
EnablePaginationEvent
Enables or disables pagination.
FilterDelegate<T extends DataGridRow>
FilterEvent
Applies a filter on a column with the given operator and value.
FilterResult
FilterScope
Scoped inherited widget that provides per-column filter data to descendant widgets.
FilterState
Active column filters, keyed by column ID.
FirstPageEvent
Navigates to the first page.
FocusCellEvent
Focuses a single cell, replacing the entire focused-cells path. Dispatched on a plain click (no modifiers).
GridLayoutDelegate
A MultiChildLayoutDelegate that positions grid cells in viewport space.
GridScrollController
Manages horizontal and vertical scroll controllers for the data grid, exposing reactive streams for scroll metric changes.
GroupByColumnEvent
Groups rows by the specified column.
GroupState
Row grouping state.
HorizontalDataGridScrollbar
Horizontal scrollbar driven by a ScrollController.
InsertRowEvent
Inserts a single row, optionally at a specific position.
InsertRowsEvent
Inserts multiple rows at the end of the grid.
LastPageEvent
Navigates to the last page.
LoadDataEvent<T>
Loads a new set of rows into the grid, optionally appending to existing data.
Navigates focus to an adjacent cell, with optional path extension.
Moves focus down by one cell (or row when no cell is active).
Moves focus left by one cell (no-op when no cell is active).
Moves focus right by one cell (no-op when no cell is active).
Moves focus up by one cell (or row when no cell is active).
NextPageEvent
Navigates to the next page.
PaginationState
Pagination configuration and position.
PreviousPageEvent
Navigates to the previous page.
RefreshDataEvent
Triggers a data refresh by setting the loading flag.
SelectAllRowsEvent
Selects all rows, or a specific set of row IDs if provided.
SelectAllVisibleEvent
Selects all currently visible rows.
SelectionState
Row and cell selection state.
SelectRowEvent
Selects or toggles a single row.
SelectRowsRangeEvent
Selects a contiguous range of rows between two row IDs.
SetFocusedCellsEvent
Replaces the focused-cells path with the given list. No SelectionMode guard — works regardless of mode.
SetLoadingEvent
Explicitly sets the loading state and optional message.
SetPageEvent
Navigates to a specific page number.
SetPageSizeEvent
Changes the number of rows displayed per page.
SetSelectionModeEvent
Changes the selection mode (none or multiple).
SetServerSidePaginationEvent
Enables or disables server-side pagination mode.
SetTotalItemsEvent
Sets the total item count (used for server-side pagination).
ShiftSelectCellEvent
Appends a cell to the focused-cells path (Shift+click). If the cell is already the last in the path, this is a no-op. Preserves all previously focused cells.
SortColumn
Identifies a sorted column and its direction.
SortCompleteEvent<T extends DataGridRow>
Internal event dispatched when an async sort operation completes.
SortDelegate<T extends DataGridRow>
Abstract delegate for handling sort operations.
SortEvent
Applies or changes the sort on a column.
SortResult
Result of a sort operation.
SortState
Current sort configuration.
ToggleCellInSelectionEvent
Toggles a cell in/out of the focused-cells path (Ctrl+click). Adds the cell if absent, removes it if present.
ToggleGroupExpansionEvent
Toggles the expanded/collapsed state of a row group.
UngroupColumnEvent
Removes grouping for the specified column.
UpdateCellEvent
Updates a single cell value on an existing row.
UpdateRowEvent
Replaces an entire row with a new instance.
VerticalDataGridScrollbar
Vertical scrollbar driven by a ScrollController.

Enums

CellNavDirection
Direction for cell navigation events.
DataGridAspect
Aspects of grid state that widgets can selectively depend on.

Extensions

ColumnFilterPatterns on ColumnFilter
Adds pattern-matching-related methods to ColumnFilter.
DataGridContext on BuildContext
DataGridStatePatterns on DataGridState<T>
Adds pattern-matching-related methods to DataGridState.
EditStatePatterns on EditState
Adds pattern-matching-related methods to EditState.
FilterStatePatterns on FilterState
Adds pattern-matching-related methods to FilterState.
GroupStatePatterns on GroupState
Adds pattern-matching-related methods to GroupState.
PaginationStatePatterns on PaginationState
Adds pattern-matching-related methods to PaginationState.
SelectionStatePatterns on SelectionState
Adds pattern-matching-related methods to SelectionState.
SortColumnPatterns on SortColumn
Adds pattern-matching-related methods to SortColumn.
SortStatePatterns on SortState
Adds pattern-matching-related methods to SortState.

Constants

kSelectionColumnId → const int
Column ID used for the selection checkbox column. Uses a very negative value to avoid conflicts with user-defined column IDs.
kSelectionColumnWidth → const double
Default width for the selection checkbox column.

Functions

parseCellId(String cellId) → (double, int)
Parses a cell ID (format: "${rowId}_${columnId}") into its components.

Typedefs

CellEditorBuilder = Widget Function(BuildContext context, dynamic value, ValueChanged onChanged)
Builder function for custom cell editor widgets.
CellFormatter<T extends DataGridRow> = String Function(T row, DataGridColumn<DataGridRow> column)
Formatter function to convert cell values to display strings.