Export Overview
FD Components separates what is exported from how it is serialized.
The export pipeline resolves a row scope and ordered columns, then delegates serialization to a format writer:
DataSet or resolved rows
↓
FdcExportOptions
(scope, values, columns)
↓
FdcExporter
↓
FdcExportWriter
↓
FdcExportResult
(text or bytes)
This keeps dataset navigation and grid presentation independent from file formats. The same source can be exported as CSV, JSON, XML, Excel-compatible SpreadsheetML, PDF, or an application-defined format.
Built-in formats
The Community package registers three formats automatically:
| Format | Descriptor | Payload |
|---|---|---|
| CSV | FdcExportFormat.csv | text |
| JSON | FdcExportFormat.json | text |
| XML | FdcExportFormat.xml | text |
FDC Pro adds:
| Format | Descriptor | Payload |
|---|---|---|
| Excel SpreadsheetML | FdcExcelExportFormat.spreadsheetXml | text/XML |
FdcPdfExportFormat.pdf | binary |
Pro writers are registered once with FdcPro.ensureInitialized().
Direct DataSet export
final result = await FdcExporter.exportDataSet(
orders,
format: FdcExportFormat.csv,
options: FdcExportOptions(
scope: FdcExportScope.currentView,
),
suggestedFileName: 'orders.csv',
);
final csv = result.text;
final bytes = result.bytes;
FdcExportResult.bytes is available for every format. text is available only for textual payloads; use textOrNull when handling both text and binary formats.
Export is not file saving
FDC generates a serialized result but deliberately does not choose a platform-specific save, download, or share mechanism. Applications can route result.bytes, result.textOrNull, MIME metadata, and suggestedFileName to the appropriate Flutter platform integration.
DataSet export versus grid export
Use FdcExporter.exportDataSet when dataset fields define the export shape.
Use FdcGridExportButton when the current grid presentation should control the exported columns. In its default visibleColumns mode, the grid exports only visible data-bound, exportable columns in their current runtime order and carries display formatting metadata into presentation-oriented writers.
See Grid Export.