pickFromContacts method

Future<void> pickFromContacts()

Implementation

Future<void> pickFromContacts() async {
  try {
    if (!await FlutterContactPicker.hasPermission() && Platform.isAndroid) {
      await FlutterContactPicker.requestPermission();
    }
    final PhoneContact contact =
        await FlutterContactPicker.pickPhoneContact();
    final String? number = contact.phoneNumber?.number;
    if (number != null) {
      phoneNumber = number.replaceAll(' ', '');
    }
  } catch (e) {
    debugPrint(e.toString());
  }
}