diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 7bbda07..d525f3d 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -93,6 +93,9 @@ class _CountryCodePickerState extends State { null) .toList(); super.initState(); + + _publishSelection(selectedItem); + } void _showSelectionDialog() { @@ -105,10 +108,14 @@ class _CountryCodePickerState extends State { selectedItem = e; }); - if (widget.onChanged != null) { - widget.onChanged(e); - } + _publishSelection(e); } }); } + + void _publishSelection(CElement e) { + if (widget.onChanged != null) { + widget.onChanged(e); + } + } }