valueByKeys method
Fetches cell's value by names of its column and row.
rowKey
- name of a row with requested cell's value
The column A considered to be row names
columnKey
- name of a column with requested cell's value
The first row considered to be column names
Returns cell's value as Future String.
Returns null
if either rowKey
or columnKey
not found.
Throws GSheetsException.
Implementation
Future<String?> valueByKeys({
required Object rowKey,
required Object columnKey,
}) async {
final rKey = parseKey(rowKey, 'row');
final cKey = parseKey(columnKey, 'column');
final rows = await allRows();
if (rows.isEmpty) return null;
final columnIndex = rows.first.indexOf(cKey);
if (columnIndex < 0) return null;
final rowIndex = whereFirst(rows, rKey);
if (rowIndex < 0) return null;
return getOrEmpty(rows[rowIndex], columnIndex);
}