From 39341b0a2a4a294cd925d41982ab8e3f5e0068fd Mon Sep 17 00:00:00 2001 From: ARAVIND99 Date: Thu, 5 Apr 2018 12:33:52 +0530 Subject: [PATCH] * initialSelection can be one of code OR dial_code --- lib/country_code_picker.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/country_code_picker.dart b/lib/country_code_picker.dart index 9bac94d..6e48144 100644 --- a/lib/country_code_picker.dart +++ b/lib/country_code_picker.dart @@ -45,7 +45,10 @@ class _CountryCodePickerState extends State { 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];