setSelected method

void setSelected(
  1. DateTime selected, {
  2. bool triggerEvents = true,
})

Implementation

void setSelected(DateTime selected, {bool triggerEvents = true}) {
  String textDate = new DateFormat('dd/MM/yyyy').format(selected);

  setState(() {
    selectedDate = selected;
    _controller.text = textDate;
  });

  if (triggerEvents) {
    if (widget.onChanged != null) {
      widget.onChanged!(textDate);
    }

    if (widget.onSelect != null) {
      widget.onSelect!(selected);
    }
  }
}