row method

Future<Map<String, String>> row(
  1. int row, {
  2. int fromColumn = 1,
  3. int length = -1,
  4. int mapTo = 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 (values 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 values starting from fromColumn will be returned

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

Returns row as Future Map of String to String.

Throws GSheetsException.

Implementation

Future<Map<String, String>> row(
  int row, {
  int fromColumn = 1,
  int length = -1,
  int mapTo = 1,
}) async {
  checkIndex('row', row);
  checkIndex('mapTo', mapTo);
  checkMapTo(row, mapTo);
  final rows = await _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 _wrap(keys, values);
}