Skip to content

[syncfusion_flutter_datagrid] resizingLine! still crashes long-press on stacked header and table summary rows in 34.2.8 #2561

Closed

Description

@bahadirarslan

Bug description

Follow-up to #2539, which was closed on 2026-07-01 after the sample did not reproduce the crash.

The null check is still in the published package. In syncfusion_flutter_datagrid 34.2.8, RenderVirtualizingCellsWidget._getDataCellBase force-unwraps resizingLine for stacked header and summary rows. Data rows already skip the lookup when resizingLine is null. A simple grid always resolves a visible line, so resizingLine! never runs and the sample stays green. A wide logbook grid (many columns, horizontal scroll, stacked headers, several bottom summary rows) does not.

34.2.8 adjusted the X position by the horizontal scroll offset (the comment in that method mentions incorrect column detection on Android). getVisibleLineAtPoint can still return null. The summary/header branch then crashes on resizingLine! before onCellLongPress is called, so an app callback cannot guard this.

Production, syncfusion_flutter_datagrid 33.2.5, app 2.6.6+169, one gesture, same trace, about one second apart:

  • Long-press start on /logbook, Android 16, Samsung phone, portrait. LongPressGestureRecognizer._checkLongPressStart → _onLongPressStart (rendering_widget.dart:1590) → _getDataCellBase line 1540.
  • Long-press end of that same gesture. _checkLongPressEnd → _onLongPressEnd (rendering_widget.dart:1608) → the same resizingLine!.

The same start/end pair was previously seen on iPad, iOS 26.3, app 2.6.0 (the crashes reported in #2539).

Steps to reproduce

  1. Build an SfDataGrid with non-empty stackedHeaderRows, at least two bottom tableSummaryRows, and enough columns that the grid scrolls horizontally.
  2. Scroll horizontally so the touch X is not on a resolved visible line for a summary or stacked-header row (getVisibleLineAtPoint returns null).
  3. Long-press a stacked header cell or a table summary cell.
  4. The framework throws on press start, then again on press end. onCellLongPress is not invoked.

Code sample

Code sample

syncfusion_flutter_datagrid 34.2.8, lib/src/datagrid_widget/widgets/rendering_widget.dart (_getDataCellBase):

final VisibleLineInfo? resizingLine = dataGridConfiguration
    .container
    .scrollColumns
    .getVisibleLineAtPoint(
      position,
      false,
      dataGridConfiguration.textDirection == TextDirection.rtl,
    );

if (dataRow.rowType == RowType.stackedHeaderRow ||
    dataRow.rowType == RowType.tableSummaryRow ||
    dataRow.rowType == RowType.captionSummaryCoveredRow ||
    dataRow.rowType == RowType.tableSummaryCoveredRow) {
  dataCell = dataRow.visibleColumns.firstWhereOrNull((DataCellBase dataCell) {
    final int cellLeft = dataCell.columnIndex;
    final int cellRight = dataCell.columnIndex + dataCell.columnSpan;

    return cellLeft == resizingLine!.lineIndex || // crash when resizingLine is null
        cellRight == resizingLine.lineIndex ||
        (resizingLine.lineIndex > cellLeft &&
            resizingLine.lineIndex < cellRight);
  });
} else {
  if (resizingLine != null) {
    dataCell = dataRow.visibleColumns.firstWhereOrNull(
      (DataCellBase element) => element.columnIndex == resizingLine.lineIndex,
    );
  }
}

Please use the same null guard in the summary/header branch. When resizingLine is null, leave dataCell null and do not throw. Long-press on a normal data row should keep opening the app context menu.

Screenshots or Video

Screenshots / Video demonstration

No new video. The failure is a fatal null-check during the gesture, on both press start and press end. #2539 has the earlier iPad report. This follow-up adds the Android production pair and confirms the ! is still present in 34.2.8 after the horizontal-offset change.

Stack Traces

Stack Traces
TypeError: Null check operator used on a null value

LongPressGestureRecognizer._checkLongPressStart
  → RenderVirtualizingCellsWidget._onLongPressStart (rendering_widget.dart:1590)
  → RenderVirtualizingCellsWidget._getDataCellBase (rendering_widget.dart:1534)
  → resizingLine! (rendering_widget.dart:1540)   // 33.2.5; 34.2.8 is the same expression at line 1553

LongPressGestureRecognizer._checkLongPressEnd
  → RenderVirtualizingCellsWidget._onLongPressEnd (rendering_widget.dart:1608)
  → RenderVirtualizingCellsWidget._getDataCellBase (same resizingLine!)

On which target platforms have you observed this bug?

  • Android
  • iOS

Flutter Doctor output

Doctor output
Production crashes: Flutter 3.41.9, Dart 3.11.5, syncfusion_flutter_datagrid 33.2.5.
Source check: syncfusion_flutter_datagrid 34.2.8 still contains resizingLine! in the stacked-header / summary branch.

Activity

  1. Muthupandy-SF4685 commented on Sep 28, 2026

    @Muthupandy-SF4685

    Hi @bahadirarslan ,

    Thank you for reaching out to us.

    We have investigated the reported "Null check operator used on a null value" exception. To validate the issue, we prepared a sample that includes horizontally scrollable columns, additional stacked header cells, and multiple table summary rows. However, despite our testing efforts, we were unable to reproduce the reported crash on our end.

    That said, we reviewed the reported code path and understand your concern regarding the use of the resizingLine! null assertion. As requested, we will remove the null operator and add appropriate null handling to ensure the code safely handles scenarios where resizingLine is null.

    This improvement will be included in our upcoming weekly patch release, which is currently scheduled for October 13, 2026. We will notify you once the release is available.
    We appreciate your detailed report and thank you for your patience and continued support.

    Code sample: SfDataGrid.zip

    Video Demo:

    Video-Demo.mp4

    Best Regards,
    Muthupandy R.

  2. added
    data grid
    on Sep 28, 2026
  3. Gowtham-SF4769 commented on Oct 13, 2026

    @Gowtham-SF4769

    Hi @bahadirarslan ,

    Thank you for your patience.

    We would like to provide a brief update regarding the planned enhancement to remove the null assertion operator and introduce the corresponding null handling. Although this improvement was originally targeted for this week's weekly release, it was unfortunately not included as anticipated.

    Please be assured that this enhancement remains in our roadmap and is planned for inclusion in one of our upcoming weekly releases. Once the improvement becomes available, we will update this ticket and notify you accordingly.

    We sincerely apologize for any inconvenience caused by this delay and greatly appreciate your understanding, patience, and continued support.

    Regards,
    Gowtham R.

  4. added
    bug
    follow-up scheduled
    on Oct 13, 2026
  5. Gowtham-SF4769 commented on Oct 14, 2026

    @Gowtham-SF4769

    Hi @bahadirarslan ,

    We are glad to inform you that the reported problem has been resolved on our end. Therefore, kindly update SfDataGrid to the latest version (35.1.40+1).

    Root cause: The _getDataCellBase method retrieves the visible column line using getVisibleLineAtPoint(), which can return null in certain scrolling scenarios. However, during stacked header and summary row processing, the value was forcefully dereferenced using the null-forgiving operator (resizingLine!). When resizingLine was null, accessing resizingLine!.lineIndex could cause a runtime exception during both long-press start and long-press end gesture handling. Regular data rows already contained null-safe handling, but the stacked header and summary row code paths did not.

    If you have any further queries, please don't hesitate to reach out. We are more than happy to assist you.

    Regards,
    Gowtham R

  6. added
    waiting for customer response
    solved
    and removed
    follow-up scheduled
    on Oct 14, 2026
  7. Gowtham-SF4769 commented on Oct 30, 2026

    @Gowtham-SF4769

    Hi @bahadirarslan ,

    We hope your issue has been resolved. As there have been no further updates or queries from your end, we will proceed with closing this ticket. Please feel free to reopen this ticket or raise a new one if you require any assistance.

    We will be happy to assist you.

    Regards,
    Gowtham R

  8. removed
    waiting for customer response
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdata gridsolved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions