• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

optimizely / optimizely-flutter-sdk / 23551768729
87%

Build:
DEFAULT BRANCH: master
Ran 25 Mar 2026 04:23PM UTC
Jobs 1
Files 27
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Mar 2026 04:21PM UTC coverage: 87.157% (+0.04%) from 87.113%
23551768729

push

github

web-flow
fix: ensure FlutterResult and invokeMethod are always called on main thread (#98)

* fix: ensure FlutterResult and invokeMethod are always called on main thread

iOS 16 requires FlutterResult to be invoked on the main thread. When
OptimizelyClient.start() or decideAsync closures call result() from a
background thread under multi-SDK startup contention, iOS 16 silently
drops the response causing the Dart Future to never resolve or return
null, which previously crashed the app with an unhandled TypeError or
PlatformException.

Two layers fixed:

1. iOS native (SwiftOptimizelyFlutterSdkPlugin.swift)
   - Added mainThreadResult() private helper that wraps FlutterResult
     to always dispatch on the main thread (no-op if already on main)
   - Applied once in handle() so every current and future method handler
     is protected automatically — no per-handler changes needed

2. Dart layer (OptimizelyClientWrapper + OptimizelyUserContext)
   - Added _invoke() helper that wraps every MethodChannel.invokeMethod
     call with a null guard and PlatformException catch
   - Null response returns {success:false} instead of crashing via
     Map.from(null) → TypeError
   - PlatformException is caught and returned as {success:false}
   - All 18 call sites in OptimizelyClientWrapper and 14 in
     OptimizelyUserContext now route through _invoke

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: update CLAUDE.md with expanded guidance and add IDE/env gitignore entries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add unit tests for _invoke() null and PlatformException safety branches

Covers the two previously-uncovered error branches in the iOS 16 fix:
- Native returns null → success:false (no TypeError)
- Native throws PlatformException → success:false (no unhandled exception)

Tests both OptimizelyClientWrapper and OptimizelyUserContext.
Overall unit test coverage: 85.9% → 87.3%

Co-Authored-By: Claude Sonnet 4.6 <noreply@ant... (continued)

50 of 50 new or added lines in 2 files covered. (100.0%)

699 of 802 relevant lines covered (87.16%)

1.91 hits per line

Jobs
ID Job ID Ran Files Coverage
1 23551768729.1 25 Mar 2026 04:23PM UTC 27
87.16
GitHub Action Run
Source Files on build 23551768729
  • Tree
  • List 27
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • e9974836 on github
  • Prev Build on master (#21441208256)
  • Next Build on master (#23551847252)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc