Skip to content

fix: guard FlutterTaskQueue for backward compatibility - #117

Open
muzahidul-opti wants to merge 2 commits into
masterfrom
fix/flutter-task-queue-compat
Open

fix: guard FlutterTaskQueue for backward compatibility#117
muzahidul-opti wants to merge 2 commits into
masterfrom
fix/flutter-task-queue-compat

Conversation

@muzahidul-opti

Copy link
Copy Markdown
Contributor

Summary

  • Guards makeBackgroundTaskQueue call with responds(to:) in SwiftOptimizelyFlutterSdkPlugin.register(with:) to support older Flutter versions (< 3.22) where FlutterTaskQueue protocol is incomplete
  • Falls back to creating the logger FlutterMethodChannel without a taskQueue when the API is unavailable
  • Adds spec document at specs/002-flutter-task-queue-compat/spec.md

Context

The testapp iOS CI uses Flutter 3.16.0 with Xcode 26.6. At this combination, the Swift compiler cannot import makeBackgroundTaskQueue because the FlutterTaskQueue protocol is forward-declared but not fully defined in the ObjC header. This causes two hard compilation errors:

error: value of type 'any FlutterBinaryMessenger' has no member 'makeBackgroundTaskQueue'
error: extra argument 'taskQueue' in call

The taskQueue parameter is an optimization (offloads logger callbacks from the main thread). Passing nil falls back to the default behavior with no functional regression.

Test plan

  • Testapp iOS CI passes with Flutter 3.16.0 + Xcode 26.6
  • Local build succeeds with Flutter 3.44.0 + Xcode 26.6 (taskQueue path taken)
  • flutter test passes (no Dart changes)

🤖 Generated with Claude Code

muzahidul-opti and others added 2 commits August 22, 2026 07:10
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant