Skip to main content

Layout Persistence

PRO
Pro preview

This feature is part of FD Components Pro, which is documented as a preview and is not publicly available yet. See Editions and Availability.

Layout persistence connects grid layout capture and restore to application-defined storage.

FdcProGrid(
dataSet: customers,
layoutPersistence: FdcGridLayoutPersistence(
autoLoad: true,
autoSave: true,
load: loadGridLayout,
save: saveGridLayout,
delete: deleteGridLayout,
),
)

Storage remains under application control. The persistence feature receives and returns FdcGridLayoutState values through the callbacks.

Auto-save delay

FdcGridLayoutPersistence(
autoSave: true,
autoSaveDelay: const Duration(milliseconds: 500),
save: saveGridLayout,
)

Automatic saves are debounced after layout changes.

Control layout state through the controller

Capture and restore an in-memory serializable layout state:

final state = controller.captureLayout();
controller.restoreLayout(state);

Save or reload through the configured persistence callbacks:

await controller.saveLayout();
await controller.saveNow();

final loaded = await controller.loadLayout();

saveNow() is an explicit alias for saveLayout(). loadLayout() returns whether a persisted layout was loaded and restored.

Reset the grid to its configured default layout and delete the persisted snapshot when a delete callback is configured:

await controller.resetLayout();

See Grid Controller for lifecycle guidance and the full Community and Pro command surfaces.