Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
Load the items from the given loader, and set the items to the dropdown menu.
The loaded items would replace the current items if replace is true;
otherwise, the loaded items would be merged with the current items.
if onException is provided, it would be called when an exception is thrown during the loading.
Restore the items to the previous state.
if onlyOnce, it would try to pop the history once to show the previous history result;
otherwise, it would clear all history and show the original items.
Search the loaded items that match the given query, and set the matched items to the dropdown menu.
It would be marked as a history without modifying the original items.
Set the given items to the dropdown menu as history items, it would be set as the top history.
if rebuild, the menu will be rebuilt after the items are set.
Set the given items to the dropdown menu.
if replace, the current items will be replaced with the given items, and all history will be cleared.
if rebuild, the menu will be rebuilt after the items are set.