* initialSelection can be one of code OR dial_code

This commit is contained in:
ARAVIND99
2018-04-05 12:46:31 +05:30
parent 39341b0a2a
commit cf3c953bde

View File

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