Skip to content

Conversation

@bleroux
Copy link
Contributor

@bleroux bleroux commented Oct 23, 2025

Description

This PR fixes the default value for DateRangePickerDialog.currentDate.
Before this PR, the comment mentions that currentDate defaults to DateTime.now() but this is not the case (the value is not initialised).
After this PR, currentDate defaults to calendarDelegate.now().

Related Issue

Fixes DateRangePickerDialog crashes when currentDate is omitted

Tests

  • Adds 1 test

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Oct 23, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a crash in DateRangePickerDialog that occurred when the currentDate parameter was omitted. The issue was caused by a null-check operator on a potentially null value. The fix correctly provides a default value for currentDate by using a getter that falls back to calendarDelegate.now(). The implementation is clean and effective. A new regression test has also been added to verify the fix and prevent this issue from recurring. The code changes look good and I have no further comments.

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@bleroux bleroux added r: fixed Issue is closed as already fixed in a newer version autosubmit Merge PR when tree becomes green via auto submit App and removed r: fixed Issue is closed as already fixed in a newer version labels Oct 31, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 31, 2025

autosubmit label was removed for flutter/flutter/177448, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2025
@bleroux bleroux force-pushed the fix_DateRangePickerDialog_default_currentDate branch from 092d83d to 34850e8 Compare October 31, 2025 14:58
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Oct 31, 2025
Merged via the queue into flutter:master with commit be736e1 Oct 31, 2025
77 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 31, 2025
@bleroux bleroux deleted the fix_DateRangePickerDialog_default_currentDate branch October 31, 2025 23:52
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 2, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 3, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 4, 2025
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
## Description

This PR fixes the default value for `DateRangePickerDialog.currentDate`.
Before this PR, the comment mentions that `currentDate` defaults to
`DateTime.now()` but this is not the case (the value is not
initialised).
After this PR, `currentDate` defaults to `calendarDelegate.now()`.

## Related Issue

Fixes [DateRangePickerDialog crashes when currentDate is
omitted](flutter#177441)

## Tests

- Adds 1 test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateRangePickerDialog crashes when currentDate is omitted

2 participants