onSearchInputChange method

void onSearchInputChange()

Implementation

void onSearchInputChange() {
  if (this.editController.text.isEmpty) {
    this.debouncer?.cancel();
    widget.onSearchInput(this.editController.text);
    return;
  }

  if (this.debouncer?.isActive ?? false) {
    this.debouncer?.cancel();
  }

  this.debouncer = Timer(Duration(milliseconds: 500), () {
    widget.onSearchInput(this.editController.text);
  });
}