PlutoGrid requires two main data structures: a list of PlutoColumn objects to define the schema and a list of PlutoRow objects to hold the data.
Column Types
Use PlutoColumnType to specify how data in a column should be handled:
PlutoColumnType.text()PlutoColumnType.number()PlutoColumnType.select(['item1', 'item2'])PlutoColumnType.date()PlutoColumnType.time()
Row Structure
Each PlutoRow contains a cells map where the keys are the field names defined in your columns, and the values are PlutoCell objects containing the actual data.
List<PlutoColumn> columns = [
PlutoColumn(
title: 'text column',
field: 'text_field',
type: PlutoColumnType.text(),
),
PlutoColumn(
title: 'number column',
field: 'number_field',
type: PlutoColumnType.number(),
),
PlutoColumn(
title: 'select column',
field: 'select_field',
type: PlutoColumnType.select(['item1', 'item2', 'item3']),
),
PlutoColumn(
title: 'date column',
field: 'date_field',
type: PlutoColumnType.date(),
),
PlutoColumn(
title: 'time column',
field: 'time_field',
type: PlutoColumnType.time(),
),
];
List<PlutoRow> rows = [
PlutoRow(
cells: {
'text_field': PlutoCell(value: 'Text cell value1'),
'number_field': PlutoCell(value: 2020),
'select_field': PlutoCell(value: 'item1'),
'date_field': PlutoCell(value: '2020-08-06'),
'time_field': PlutoCell(value: '12:30'),
},
),
// ... additional rows
];