count property

int count

Gets the cells count.

//Create a new PDF document
PdfDocument document = PdfDocument();
//Create a PdfGrid
PdfGrid grid = PdfGrid();
//Add columns to grid
grid.columns.add(count: 3);
//Add headers to grid
PdfGridRow header = grid.headers.add(1)[0];
header.cells[0].value = 'Employee ID';
header.cells[1].value = 'Employee Name';
header.cells[2].value = 'Salary';
//Add rows to grid
PdfGridRow row1 = grid.rows.add();
//Gets the cell collection from the row
PdfGridCellCollection cellCollection = row1.cells;
//Gets the specific cell from the row collection
PdfGridCell cell1 = cellCollection[0];
cell1.value = 'E01';
cell1.style.cellPadding = PdfPaddings(left: 0, right: 0, top: 10, bottom: 10);
cellCollection[1].value = 'Clay';
cellCollection[2].value = '\$10000';
PdfGridRow row2 = grid.rows.add();
row2.cells[0].value = 'E02';
row2.cells[1].value = 'Simon';
row2.cells[2].value = '\$12,000';
//Gets the cells count
int cellsCount = cellCollection.count;
//Gets the index of particular cell
int index = cellCollection.indexOf(cell1);
//Draw the grid in PDF document page
grid.draw(
    page: document.pages.add(), bounds: Rect.zero);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

int get count => _helper._cells.length;