fix(device_info_plus): fix memory leak when calling DeviceInfoPlugin().macOsInfo#3474
Conversation
miquelbeltran
left a comment
There was a problem hiding this comment.
Hello! Thanks for the contribution. The refactor and the change seem fine to me, but before approving I'd need to test it and also fix CI because seems like something broke with the installation scripts, that may delay this PR for a while.
I've also got a question regarding the use of enum.
|
|
||
| public struct SystemUUID { | ||
|
|
||
| public enum SystemUUID { |
There was a problem hiding this comment.
Why is there a change from struct to enum?
There was a problem hiding this comment.
This API is designed as SystemUUID.getSystemUUID(), essentially just placing getSystemUUID() under the SystemUUID namespace.
There’s no need to declare a separate class or struct—using an enum is the most lightweight way to achieve this in Swift.
This is a common practice and also the default rule (enumNamespaces) in SwiftFormat.
miquelbeltran
left a comment
There was a problem hiding this comment.
Thank you! tested on M1 Pro
Description
Fix memory leak when call DeviceInfoPlugin().macOsInfo in macOS.
Related Issues
[Bug]: device_info_plus memory leak in macOS
Checklist
CHANGELOG.mdnor the plugin version inpubspec.yamlfiles.flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!in the title as explained in Conventional Commits).