Flutter dart debugger breakpoints stopped working
Don't use relative imports in lib/main.dart
import 'app_strings.dart';import 'net_libs_page/net_libs_page.dart';
instead use
import 'package:my_app/app_strings.dart';import 'package:my_app/net_libs_page/net_libs_page.dart';
where my_app
is what is in pubspec.yaml
in the name:
field.
The issue where this is tracked https://github.com/dart-lang/sdk/issues/33076
Seems that capitalization for the path inside import path causes breakpoints to stop working. Ie:
package:myApp/model/myWidget/myWidget.dart
and
package:myApp/model/MyWidget/MyWidget.dart
are not the same for debugging. Funny thing is that the app launches without any problem with incorrect path capitalization.
For those who use flutter on VS Code,
please take a look at changes you've made regarding dart file names.
I was having the same issue on VS Code. it showed no compilation error, worked fine but breakpoint did not work.
while I was going through changes I made and I looked at few of dart files that I changed to.
For example, I changed "Home.dart" to "home.dart",, and so on.
Even when you change files' names, VS Code sometimes doesn't reflect changes,
which means even though you changed Home.dart to home.dart,
left panel shows home.dart while right panel where it shows files you opened still shows "Home.dart"
pictures below explains everything I just address.
solution is to simply close all the dart files you opened, close VS Code, and reopen it. this worked for me.