Skip to content

Commit 280bf29

Browse files
fix(web): guard URL strategy import on js_interop, not html (#537)
`dart:html` is only provided by dart2js, so under dart2wasm the conditional import fell through to the no-op stub and path-based URLs silently reverted to hash routing — the outcome ADR 0004 rejected. `dart.library.js_interop` is the supported "compiling for the web" condition on both dart2js and dart2wasm, so the guard now holds on either compiler. `kIsWeb` already gates the call itself. Fixes #525
1 parent 68c0885 commit 280bf29

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/main.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ import 'services/services.dart';
1414
import 'utils/utils.dart';
1515
import 'widgets/widgets.dart';
1616
import 'firebase_options.dart';
17+
// Guarded on dart.library.js_interop, not dart.library.html: `dart:html` is
18+
// only provided by dart2js, so a `--wasm` build would silently fall through to
19+
// the no-op stub and revert to hash routing (see ADR 0004, issue #525).
1720
import 'url_strategy_stub.dart'
18-
if (dart.library.html) 'package:flutter_web_plugins/url_strategy.dart';
21+
if (dart.library.js_interop) 'package:flutter_web_plugins/url_strategy.dart';
1922

2023
void main() async {
2124
// coverage:ignore-start

0 commit comments

Comments
 (0)