* initialSelection can be one of code OR dial_code
This commit is contained in:
@@ -45,10 +45,8 @@ class _CountryCodePickerState extends State<CountryCodePicker> {
|
|||||||
initState() {
|
initState() {
|
||||||
if (widget.initialSelection != null) {
|
if (widget.initialSelection != null) {
|
||||||
selectedItem = elements.firstWhere(
|
selectedItem = elements.firstWhere(
|
||||||
(e) {
|
(e) => (e.code.toUpperCase() == widget.initialSelection.toUpperCase()) ||
|
||||||
e.code.toUpperCase() == widget.initialSelection.toUpperCase() ||
|
(e.dialCode == widget.initialSelection.toString()),
|
||||||
e.dialCode == widget.initialSelection.toString();
|
|
||||||
},
|
|
||||||
orElse: () => elements[0]);
|
orElse: () => elements[0]);
|
||||||
} else {
|
} else {
|
||||||
selectedItem = elements[0];
|
selectedItem = elements[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user