Closed Calin-Cosma closed 5 years ago
Can you try using a different package to handle permissions? The simple_permissions repository seems to have either been deleted or made private.
I actually tried these 2:
https://github.com/AppleEducate/flutter_simple_permissions ( https://pub.dartlang.org/packages/contacts_service links to it)
and
https://pub.dartlang.org/packages/permission_handler
The first one got me the error I posted. The second one cause a whole different error (I posted an issue on their Github, too).
I am quite new to Flutter/Dart, and while it seems like a pretty cool language with a thriving community, it's disappointing that some basic stuff is missing (like being able to access the contacts) and has to be developed by the community.
Since I am new to Flutter, I am starting to wonder if I am wasting my time trying to build an app with it. If accessing the contacts is so difficult, how many of these problems will I run into, even for a relatively simple app ?
It would be great if the devs for contacts_service could update their README and put some working code there.
@Calin-Cosma The issue you are facing may be because of this Flutter update. It broke many plugins for Android(which is probably why it was working on your iOS simulator), and flutter_contacts was one of them.
flutter_contacts was migrated to AndroidX quite recently, so it should be working now.
Try using the latest version of flutter_contacts contacts_service: ^0.2.1
, and migrate to AndroidX.
@Calin-Cosma bug fixes have been resolved. Please use the latest version 0.2.3 and review the example app for ways to implement into your app.
I've tested extensively Android Pixel 2 (API 28) and iOS. Everything is working. Closing this issue, but feel free to re-open if you think there's a problem with the plugin.
I am using an emulation of a Pixel 2 (Android 28).
pubspec.yaml
After adding the dependencies to contacts_service and simple_permissions and some test code, I get:
If I try to do
flutter clean
and then try to run the app, I get:
The code of my function:
I did add the required lines in the Android Manifest and plist, and in fact it works in the iOs emulator.