3

I have a Flutter Web project, and when an error is thrown, I can't open the dart file where the error was thrown, because the error line points to a JS file:

Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
This app is linked to the debug service: ws://127.0.0.1:63045/gOvW2paMrLg=/ws
Debug service listening on ws://127.0.0.1:63045/gOvW2paMrLg=/ws

 Running with sound null safety 
Debug service listening on ws://127.0.0.1:63045/gOvW2paMrLg=/ws
Error: Invalid argument(s): A value must be provided. Supported values: 0, 1
    at Object.throw_ [as throw] (http://localhost:53846/dart_sdk.js:5061:11)
    at Object._$36enumDecode [as _$enumDecode] (http://localhost:53846/packages/web_app/core/models/pessoa/pessoa.dart.lib.js:482:17)
    at Object._$36PessoaFromJson [as _$PessoaFromJson] (http://localhost:53846/packages/web_app/core/models/pessoa/pessoa.dart.lib.js:473:54)
    at Function.fromJson (http://localhost:53846/packages/web_app/core/models/pessoa/pessoa.dart.lib.js:375:21)
    at http://localhost:53846/packages/web_app/repository/pessoa_repository.dart.lib.js:60:193
    at repository.RepositoryGetter.new.getRecurso (http://localhost:53846/packages/web_app/repository/repository.dart.lib.js:33:18)
    at getRecurso.next (<anonymous>)
    at http://localhost:53846/dart_sdk.js:38640:33
    at _RootZone.runUnary (http://localhost:53846/dart_sdk.js:38511:59)
    at _FutureListener.thenAwait.handleValue (http://localhost:53846/dart_sdk.js:33713:29)
    at handleValueCallback (http://localhost:53846/dart_sdk.js:34265:49)
    at Function._propagateToListeners (http://localhost:53846/dart_sdk.js:34303:17)
    at _Future.new.[_completeWithValue] (http://localhost:53846/dart_sdk.js:34151:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:53846/dart_sdk.js:34172:35)
    at Object._microtaskLoop (http://localhost:53846/dart_sdk.js:38778:13)
    at _startMicrotaskLoop (http://localhost:53846/dart_sdk.js:38784:13)
    at http://localhost:53846/dart_sdk.js:34519:9

How can I make it to show the dart file where the error occurred, instead of a JS file?

I'm using Flutter Channel stable 2.5.2, Android Studio version 2020.3.

4
  • 1
    Have you solved this issue? Commented Nov 12, 2021 at 18:40
  • Hi, unfortunately not yet. I will open an issue in the flutter official repository about it Commented Nov 12, 2021 at 19:58
  • 1
    There's already an issue about it opened in flutter repository: github.com/flutter/flutter/issues/88636 Commented Nov 12, 2021 at 20:05
  • @h3wro I have found a workaround. Check my answer. Commented Feb 2, 2022 at 19:32

2 Answers 2

1

I have found a workaround for this issue.

You basically have to install a third-party patch; it will translate the paths in JS and point to the right line in dart file.

Download the patch and follow the instructions here: https://github.com/obeobe/flutter-web-exception-mapper

Sign up to request clarification or add additional context in comments.

Comments

0

Optionally you can see trace of dart files in the browser.

Make sure you have source maps enabled in your browser.

got the answer from this link on github

Comments

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.