Flutter web build: Contact Picker API considered Insecure

50 Views Asked by At

I'm using flutter build web to generate a web application which uses the fluttercontactpicker package, which claims to have support for the Contact Picker API for web.

The main problem is I'm running the app on Safari and Safari mobile (iOS 17.0) and I receive the following error: "SecurityError: The operation is insecure.", but window.isSecureContext === true, and FlutterContactPicker.available returns true.

The code:

Future presentContactDialog() async {
    print(FlutterContactPicker.available);
    try {
      final PhoneContact contact =
          await FlutterContactPicker.pickPhoneContact();
      if (contact.fullName != null) {
        // HANDLING
      }
    } catch (err) {
      print(err);
      showCupertinoDialog(
          context: context,
          builder: (context) => CupertinoAlertDialog(
                title: const Text("Impossibile operare sui contatti"),
                actions: [
                  CupertinoButton(
                      child: const Text("OK"),
                      onPressed: () => Navigator.pop(context))
                ],
              ));
    }
  }

The page is deployed on an HTTPS (certbot) website.

Steps to reproduce:

  1. flutter build web
  2. upload to my website through ftp the build/web directory
  3. install the PWA
  4. start Safari web inspector
  5. tap the widget which calls the function
0

There are 0 best solutions below