toggleUserPicked method

void toggleUserPicked(
  1. DateTime date
)

Toggles the user-picked date.

When a user selects a date, this method is called to update the selected date. It also calls the callback with the picked date to notify listeners of the change.

Implementation

void toggleUserPicked(DateTime date) {
  _userPicked = date;
  debugPrint('Picked date: ${date.toString()}');

  // If the callback exists, call it with the picked date wrapped in a List
  if (_onUserPickedCallback != null) {
    _onUserPickedCallback!([date]); // Pass the date as a list
  }

  notifyListeners();
}