fix: guard FlutterTaskQueue for backward compatibility - #117
Open
muzahidul-opti wants to merge 2 commits into
Open
fix: guard FlutterTaskQueue for backward compatibility#117muzahidul-opti wants to merge 2 commits into
muzahidul-opti wants to merge 2 commits into
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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