QuisApp / flutter_contacts

MIT License
83 stars 138 forks source link

Replace GlobalScope with CoroutineScope #135

Closed marcelomfranca closed 11 months ago

marcelomfranca commented 11 months ago

Replace GlobalScope with CoroutineScope

Description

This pull request aims to improve the code quality and resource management of the developer plugin package by replacing the usage of GlobalScope with CoroutineScope in the FlutterContactsPlugin class.

GlobalScope is a top-level coroutine scope that lives throughout the entire application lifecycle. While it may seem convenient for launching coroutines, it can lead to potential issues such as memory leaks and uncontrolled coroutine lifecycles. To address these concerns, we propose replacing GlobalScope with a more controlled CoroutineScope.

Key Benefits

Overall, this change enhances the reliability and maintainability of the plugin, contributing to a more robust and efficient package for Flutter developers.

Testing Done

In addition, this pull request includes updates based on testing performed on Android One devices. The plugin was compiled into the project, and functionality was thoroughly tested to ensure that it operates as expected on this platform.

joachim-quis commented 11 months ago

Thanks @marcelomfranca for this PR and detailed explanation!

marcelomfranca commented 11 months ago

Thanks @marcelomfranca for this PR and detailed explanation!

Thank you! Please do more tests to ensure everything is working. I'm waiting for a new version on pub.dev.