call method

Future<bool> call({
  1. required String label,
  2. int? index,
})

Makes a call to a contact’s phone. It is based on the label and, optionally, on the position of the number (index) in the list of phones with the same label. In case index is null, the 1º in the list is called.

Implementation

Future<bool> call({
  required String label,
  int? index,
}) {
  final List<Phone> phonesForCall =
      phones.where((phone) => phone.label == label).toList();

  return phonesForCall[index ?? 0].call();
}