-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Hi, when I run the simple example, the GUI stops for some time, instead of having the circular progress indicator continue spinning until the contacts are shown. I first reported it here flutter/flutter#91992 , but now I understand this is a flutter_contacts issue. See a video here:
flutter-slow-contacts.mp4
I checked, and I'm pretty sure that the cause is that serializing the contacts is done on the main thread. I checked this by replacing this line:
GlobalScope.launch(Dispatchers.Main) { result.success(contacts) }
With this:
GlobalScope.launch(Dispatchers.Main) { result.success(contacts.subList(0, 5)) }
Meaning that all the contacts are retrieved from the phone, but only the first 5 are sent to the flutter app. In this case, the app doesn't hang.
I would be happy to try to fix this and send a pull request. I already managed to move the serialization to a thread in a sample app. However, android studio can't analyze the android directory for some reason, so it makes fixing this much harder. I reported it here: #31
Thanks,
Noam