searchAddress method
Implementation
Future<void> searchAddress(String text) async {
if (widget.prepareQuery != null) {
text = widget.prepareQuery!(text);
}
if (text != _lastText && text.isNotEmpty) {
assert(
(widget.postalCodeLookup == true &&
widget.type == null &&
widget.types == null) ||
(widget.postalCodeLookup == false &&
widget.type == null &&
widget.types == null) ||
(widget.postalCodeLookup == null &&
widget.type == null &&
widget.types == null) ||
(widget.postalCodeLookup == null &&
widget.type != null &&
widget.types == null) ||
(widget.postalCodeLookup == null &&
widget.type == null &&
widget.types != null),
'You can only supply value for [type], [types] (or deprecated `postalCodeLookup`). No combinations allowed');
_lastText = text;
suggestions = await addressService.search(text,
includeFullSuggestionDetails:
(widget.onInitialSuggestionClick != null),
types: [
if (widget.postalCodeLookup == true)
AutoCompleteType.postalCode
else if (widget.postalCodeLookup == false ||
(widget.type == null && widget.types == null))
AutoCompleteType.address
else if (widget.type != null)
widget.type!
else if (widget.types != null)
...widget.types!
]);
}
if (entry != null) {
entry!.markNeedsBuild();
}
}