row method

Future<Map<String, Cell>> row(
  1. int row, {
  2. int fromColumn = 1,
  3. int mapTo = 1,
  4. int length = -1,
})

Fetches specified row, maps it to other row and returns map.

Expands current sheet's size if requested range is out of sheet's bounds.

row - index of a requested row (values of returned map), rows start at index 1

fromColumn - optional (defaults to 1), index of a column that requested row starts from (cells before fromColumn will be skipped), columns start at index 1 (column A)

length - optional (defaults to -1), the length of a requested row if length is -1, all cells starting from fromColumn will be returned

mapTo - optional (defaults to 1), index of a row to map cells to (keys of returned map), rows start at index 1

Returns row as Future Map of String to Cell.

Throws GSheetsException.

Implementation

Future<Map<String, Cell>> row(
  int row, {
  int fromColumn = 1,
  int mapTo = 1,
  int length = -1,
}) async {
  checkIndex('row', row);
  checkIndex('mapTo', mapTo);
  checkMapTo(row, mapTo);
  final rows = await _cells._ws.values.allRows(
    fromColumn: fromColumn,
    length: length,
  );
  final keys = get(rows, at: mapTo - 1, or: <String>[])!;
  final values = get(rows, at: row - 1, or: <String>[])!;
  return _wrapRow(keys, values, row, fromColumn);
}