[DART Plugin] breakpoint inside lib folder?


My project is layouted as below:

// -----

>> In "bin" directory :

library gtsi_web;
import 'package:redstone/server.dart' as app;
import 'package:shelf_static/shelf_static.dart';

part '../lib/endpoints.dart';

main() {
app.setShelfHandler(createStaticHandler(env(ENV_BASEDIR_WEB), defaultDocument: "index.html", serveFilesOutsidePath: true));
app.start(port: 9090);

>> In "lib" directory:

part of gtsi_web;

itWorks() => "It works!";

// -----

My content root is defined to: D:\NIO\dev\workspaces-idea\chicago\gtsi_web (below, there are bin/ and lib/ folders) without any exclusion.

Setting a breakpoint in endpoints.dart is not taken into account. Message: Error: Dart_SetBreakpoint: could not set breakpoint at line 4 in 'package:gtsi_web/endpoints.dart'

Any help appreciated.

Configuration info:
- IntelliJ IDEA 14.0.1 (Community)
- Dart plugin 139.231

Comment actions Permalink

There's a problem with your project structure.
'lib' folder contents is a common part of your project and it must be self-sufficient. It may contain libraries (in terms of Dart, i.e. files with library xxx; statements) and all library parts also must be within lib folder. But it can't contain parts without main library file.
In your case main library 'gtsi_web' file is in bin, so all its parts must be in bin (or subfolder).

When you reorganize your project all references from bin or web folder to lib folder contents MUST NOT be using relative path like import "../lib/foo.dart". Correct way is import "package:MyProjectName/foo.dart".
Files in lib can't reference files outside of lib, they can only depend on other packages configured in pubspec.yaml.
With correctly setup project you'll have no problems with debugging.
See project sample attached.

Comment actions Permalink

OK, I will engage a refactoring soon.

Thanks for the explanation and your time.



Please sign in to leave a comment.