selectRanges method

Future<void> selectRanges(
  1. Iterable<CellRange> ranges, {
  2. int? activeRow,
  3. int? activeCol,
  4. bool show = false,
})

Select multiple rectangular ranges.

Implementation

Future<void> selectRanges(
  Iterable<CellRange> ranges, {
  int? activeRow,
  int? activeCol,
  bool show = false,
}) async {
  final normalized = ranges
      .map((range) => CellRange()
        ..row1 = range.row1 < range.row2 ? range.row1 : range.row2
        ..col1 = range.col1 < range.col2 ? range.col1 : range.col2
        ..row2 = range.row1 > range.row2 ? range.row1 : range.row2
        ..col2 = range.col1 > range.col2 ? range.col1 : range.col2)
      .toList(growable: false);
  if (normalized.isEmpty) return;
  await VolvoxGridService.Select(_buildSelectRequest(
    activeRow ?? normalized.first.row1,
    activeCol ?? normalized.first.col1,
    normalized,
    show: show,
  ));
  notifyListeners();
}