3

I have built a flutter web app using the command:

flutter build web --release --source-maps

I am running this app on localhost and also on cloud (GCP Cloud Run). In both cases, the web app throws exceptions which are logged in the Chrome Developer Tools console within the file main.dart.js. The main.dart.js file is a minified/compiled file (low-level & unreadable) and I can't debug the errors logged within in. To debug the errors, I need Chrome to point the location of errors in my source code.

This should be accessible using Source Maps. My web app has source maps enabled and I can see all my source code directories and files in Chrome Devtools > Sources. However, when I click on any .dart file within the listed Sources, all I see is:

Could not load content for http://localhost:3000/lib/main.dart (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)

I have the same error (404) in both cloud & localhost builds, for all source code .dart files

My minified/compiled Javascript file main.dart.js has this source map link attached at the bottom:

//# sourceMappingURL=main.dart.js.map

I also have Enable Javascript source maps setting enabled within Chrome Devtools.

Here's an image of the problem: 404 error when viewing source maps

How do I fix this?

Thanks!

1
  • 1
    Any updates, so far? Commented Apr 23, 2024 at 13:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.