openSearch method

void openSearch()

Expands the search bar.

Equivalent to setting isSearchActive: true on the widget. Notifies listeners so any parent widget bound to this controller can rebuild.

ElevatedButton(
  onPressed: _searchController.openSearch,
  child: const Text('Search'),
)

Implementation

void openSearch() {
  if (_isSearchOpen) return; // idempotent
  _isSearchOpen = true;
  notifyListeners();
}