Merge pull request #1 from Aravind99/master

* initialSelection can be one of code OR dial_code
This commit is contained in:
Salvatore Giordano
2018-04-05 09:15:29 +02:00
committed by GitHub

View File

@@ -45,7 +45,10 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
initState() {
if (widget.initialSelection != null) {
selectedItem = elements.firstWhere(
(e) => e.code.toUpperCase() == widget.initialSelection.toUpperCase(),
(e) {
e.code.toUpperCase() == widget.initialSelection.toUpperCase() ||
e.dialCode == widget.initialSelection.toString();
},
orElse: () => elements[0]);
} else {
selectedItem = elements[0];