Dart editor "source not available"

172 views Asked by At

I have the following basic code:

import 'package:jwt/json_web_token.dart';

main() {
  final jwt = new JsonWebTokenCodec(secret:'***'); 
  print(jwt.isValid('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NmYy5hdXRoMC5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDc2MTcxNDk0MjIzMjU3MTU5MTciLCJhdWQiOiJ5a2h5NVJVbEpNSGw4Tzc0bGJ3Z29GZVVkUkI0VzZKRiIsImV4cCI6MTQxNjUzNTk3NCwiaWF0IjoxNDE2NDk5OTc0fQ.K_xAuG_rIAFe-zFFqn8SqXby3aqAkRJP2HrOjMnNUu0'));
  print(jwt.decode('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NmYy5hdXRoMC5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDc2MTcxNDk0MjIzMjU3MTU5MTciLCJhdWQiOiJ5a2h5NVJVbEpNSGw4Tzc0bGJ3Z29GZVVkUkI0VzZKRiIsImV4cCI6MTQxNjUzNTk3NCwiaWF0IjoxNDE2NDk5OTc0fQ.K_xAuG_rIAFe-zFFqn8SqXby3aqAkRJP2HrOjMnNUu0'));
}

I then step inside the jwt package and set a breakpoint in the decode function. When I try to run my code I get the message: "Source not available Source not available for JsonWebTokeCodec.decode() ", which is strange since I stepped into the code to set the breakpoint. Is it not possible to set a breakpoint in an imported library?

Could it be my project structure that messes things up? The file is called server.dart and is in a folder called bin. There is also a app.yaml, Dockerfile and a package.json file in the root dir of the project. (I started out following the appengine example)

Edit: Im running it directly from the dart editor (the green play button, which I guess does pub serve), not using the appengine package at all. I also deleted app.yamland dockerfileand the problem still persists. I also tried creating a new project (shelf template project) but was still not able to see the source code when the editor breaks on a breakpoint in imported code.

2

There are 2 answers

1
oskbor On BEST ANSWER

I was running a dev version of Dart 1.8, when I reinstalled Dart 1.7.2, the issue disappeared.

1
Günter Zöchbauer On

I think this is because debugging is not yet supposed to work for Dart AppEngine applications.

The related bug should be fixed but the used google/dart-runtime Docker images is still Dart 1.7.2 which doesn't contain the fix.

See also