fix(connectivity_plus): release iOS multi-engine callbacks - #3957
fix(connectivity_plus): release iOS multi-engine callbacks#3957FeliksLv01 wants to merge 2 commits into
Conversation
|
Closing this premature submission. I will reopen a validated PR with the required template, test results, and issue context. |
|
CI note: the remaining failures are unrelated to the iOS callback lifecycle change in this PR. Flutter 3.47 introduced repository-wide toolchain validation and formatting migrations: some example projects require Gradle/Kotlin upgrades, and Dart 3.13 reformats an existing share_plus test. This PR also temporarily touches three package examples to unblock pub validation, which triggers their package-specific workflows; the package_info_plus iOS integration failure is a pre-existing CocoaPods sandbox/Podfile.lock synchronization issue. The connectivity_plus analyzer, unit tests, pub dry-run, and iOS/macOS example builds pass. |
Description
Fixes iOS lifecycle retention in applications that register
connectivity_pluson multiple FlutterEngine instances. The plugin and its connectivity provider currently retain each other through bound callback references.PathMonitorConnectivityProviderandNWPathMonitorhave the same retention pattern.This change uses weak callback captures and publishes the plugin instance through the registrar. Flutter can then invoke
detachFromEnginewhen an engine is deallocated, which clears the EventChannel sink and stops the monitor.Related Issues
Checklist
Validation
melos run formatpassed without tracked-file changes.flutter pub publish --dry-runforconnectivity_pluspassed from a clean working tree.example/analysis_options.yamlmodified inandroid_intent_plus,connectivity_plus, andpackage_info_plus; pub rejects each dirty package. This PR does not modify those files.Breaking Change