Skip to content

fix: drop universal_io so the package is WASM compatible - #1199

Open
Eimen2018 wants to merge 1 commit into
masterfrom
fix/1105-drop-universal-io-for-wasm
Open

Eimen2018 wants to merge 1 commit into
masterfrom
fix/1105-drop-universal-io-for-wasm

Conversation

@Eimen2018

Copy link
Copy Markdown
Collaborator

Summary

Makes stacked WASM compatible on pub.dev. Refs #1105.

Problem

pub.dev marks stacked 3.5.0 as not WASM compatible, and stacked_services inherits that because it imports stacked. The reason pub.dev gives:

package:stacked/stacked.dart → router_utils.dart → package:universal_io/io.dart → ... → internet_address.dart → dart:io

universal_io was only used for one check, Platform.isIOS || Platform.isMacOS in buildAdaptivePageRoute, and that check already sits behind a kIsWeb guard. The latest universal_io is itself not WASM ready, so upgrading it does not help.

Change

  • router_utils.dart: use defaultTargetPlatform from flutter/foundation instead of Platform.
  • pubspec.yaml: remove universal_io.

Behaviour is the same on every platform. A side benefit is that the check now respects debugDefaultTargetPlatformOverride in tests.

Verification

  • pana (the analyser pub.dev uses) on this branch: is:wasm-ready, platform support 20/20. On master it is not WASM ready.
  • Built a test app with flutter build web --wasm against this branch and ran it in a browser. Confirmed it ran the .wasm module with no JS fallback, buildAdaptivePageRoute worked, and the console was clean.
  • flutter test: 93 passed. dart analyze: no issues in the changed file.

🤖 Generated with Claude Code

universal_io resolves to a file importing dart:io under the wasm runtime, so pub.dev marks stacked (and stacked_services through it) as not WASM compatible. It was only used for Platform.isIOS / isMacOS in buildAdaptivePageRoute, which defaultTargetPlatform covers.

Refs #1105

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

LCOV of commit bf641d9 during Test Package #156

📊 Summary Coverage

Metric Coverage Details
📈 Lines 🔴 7.6% 279 / 3689 lines
🔧 Functions ⚪ N/A no data found
🌿 Branches ⚪ N/A no data found

📁 Files Changed Coverage

File Lines Functions Branches
lib/src/code_generation/router_annotation/extended_navigator.dart ⚪ – (0) ⚪ – (0) ⚪ – (0)
lib/src/code_generation/router_annotation/router_utils.dart ⚪ – (0) ⚪ – (0) ⚪ – (0)

🟢 ≥ 90% · 🟡 ≥ 70% · 🔴 below 70% · ⚪ no data
Full coverage report

@ferrarafer ferrarafer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

2 participants