Skip to content

Fix analytics events crashing on web#407

Merged
passsy merged 1 commit into
stablefrom
analytics-web-isolate-guard
Jun 8, 2026
Merged

Fix analytics events crashing on web#407
passsy merged 1 commit into
stablefrom
analytics-web-isolate-guard

Conversation

@passsy

@passsy passsy commented Jun 8, 2026

Copy link
Copy Markdown
Member

WiredashAnalytics.trackEvent crashed on web. It reads Isolate.current.debugName
to decide whether it's running on the main isolate, but dart:isolate is
unsupported on dart4web, so Isolate.current throws there.

Web has no background isolates, so treat it as the main isolate and route the
event directly:

final bool isMainIsolate = kIsWeb || Isolate.current.debugName == 'main';

`Isolate.current` throws `Unsupported operation: dart:isolate is not
supported on dart4web`, so tracking any analytics event crashed the app
on the web. The web has no background isolates, so treat it as the main
isolate and route the event directly instead of probing Isolate.current.
@passsy passsy merged commit 38d4c88 into stable Jun 8, 2026
8 checks passed
@passsy passsy deleted the analytics-web-isolate-guard branch June 8, 2026 09:18
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