Skip to content

Exception with showCupertinoDatePicker when year is flicked beyond first and last date. #30

@aj-Thapa

Description

@aj-Thapa

I was trying the showCupertinoDatePicker() method as:

void getNepaliDateTimeCupertino(BuildContext context) {
  picker.showCupertinoDatePicker(
    context: context,
    initialDate: NepaliDateTime.now(),
    firstDate: NepaliDateTime(2000),
    lastDate: NepaliDateTime(2090),
    onDateChanged: (newDate) {
      setState(() {
        _cupertineSelectedDate = newDate.toString();
      });
    },
  );
}

Apparently, when I swipe to the end of the either first or last year, and then give a long swipe (towards the no more year shown end), an exception occurs stating:

════════ Exception caught by gesture ═══════════════════════════════════════════
Supported year is 1970-2250
'package:nepali_utils/src/nepali_date_time.dart':
Failed assertion: line 75 pos 15: 'year >= 1969 && year <= 2250'
════════════════════════════════════════════════════════════════════════════════

I don't think this should happen with such flicks/swipes at the extreme year ends, but it happens. Also, because in the latest update it was stated that the supported date range was years 1970-2250 but practically that did not happen with date picker, and only between 2000-2090 were rendered properly without error messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions