Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Respond to PR comments
  • Loading branch information
elliette committed Oct 2, 2024
commit 5a48068b3959db789e78545aa93b022d7e0cd32b
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,16 @@ SingleMapping? _cachedJsSourceMapping;
SingleMapping? _cachedWasmSourceMapping;

Future<SingleMapping?> _fetchSourceMapping() async {
final cachedSourceMapping = preferences.wasmEnabled.value
? _cachedWasmSourceMapping
: _cachedJsSourceMapping;
final cachedSourceMapping =
kIsWasm ? _cachedWasmSourceMapping : _cachedJsSourceMapping;

return cachedSourceMapping ?? (await _initializeSourceMapping());
}

Future<SingleMapping?> _initializeSourceMapping() async {
try {
final wasmEnabled = preferences.wasmEnabled.value;
final sourceMapUri = Uri.parse(
'main.dart.${wasmEnabled ? 'wasm' : 'js'}.map',
'main.dart.${kIsWasm ? 'wasm' : 'js'}.map',
);
final sourceMapFile = await get(sourceMapUri);

Expand All @@ -133,7 +131,7 @@ Future<SingleMapping?> _initializeSourceMapping() async {
);
} catch (_) {
// Ignore any errors loading the source map.
return Future.value();
return null;
}
}

Expand Down