fix: guard FlutterTaskQueue for backward compatibility - #117
Conversation
FlutterTaskQueue protocol is incomplete in Flutter < 3.22 headers, causing Swift compilation errors with modern Xcode (26.6+). Use responds(to:) to fall back gracefully when the API is unavailable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The responds(to:) guard was insufficient — Swift rejects the code at compile time because FlutterTaskQueue is an incomplete protocol in older Flutter headers. Remove makeBackgroundTaskQueue usage entirely; the logger already dispatches to main thread via DispatchQueue.main.async. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@copilot resolve the merge conflicts in this pull request |
…eue-compat Co-authored-by: muzahidul-opti <129880873+muzahidul-opti@users.noreply.github.com>
Merged |
|
@copilot review the pr |
Co-authored-by: muzahidul-opti <129880873+muzahidul-opti@users.noreply.github.com>
Review complete. The Swift fix is correct — One spec doc inaccuracy was found and fixed (commit |
pvcraven
left a comment
There was a problem hiding this comment.
Removes logger/background task for backwards compatability.
Summary
makeBackgroundTaskQueuecall withresponds(to:)inSwiftOptimizelyFlutterSdkPlugin.register(with:)to support older Flutter versions (< 3.22) whereFlutterTaskQueueprotocol is incompleteFlutterMethodChannelwithout ataskQueuewhen the API is unavailablespecs/002-flutter-task-queue-compat/spec.mdContext
The testapp iOS CI uses Flutter 3.16.0 with Xcode 26.6. At this combination, the Swift compiler cannot import
makeBackgroundTaskQueuebecause theFlutterTaskQueueprotocol is forward-declared but not fully defined in the ObjC header. This causes two hard compilation errors:The
taskQueueparameter is an optimization (offloads logger callbacks from the main thread). Passingnilfalls back to the default behavior with no functional regression.Test plan
flutter testpasses (no Dart changes)🤖 Generated with Claude Code