Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter dart debugger breakpoints stopped working

I'm learning Dart and Flutter and developing a small Android Flutter app under Android Studio 3.1.2. Suddenly debugger breakpoints stopped working - the app started in debug mode never stops on them, and the red dots indicating breakpoints change to red dots with x inside. The only place in my app where they still work is in the main.dart module.

I cleaned the project many times, tested on two different devices, uninstalled completely my Flutter debug app, and started new - nothing helps. Flutter update on beta (current beta 2) channel does nothing. Also tried switching to dev and master channels - no help.

Did anyone encounter a similar situation, how do deal with it?

Edit, adding mail.dart and output of flutter doctor (currently on the master branch, but have the same problem after switching to beta or dev branches):

Imports from main.dart, or better all of main.dart:

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

import 'app_strings.dart';
import 'net_libs_page/net_libs_page.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      localizationsDelegates: [
        // ... app-specific localization delegate[s] here
        AppLocalizationsDelegate(),
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        //FallbackMaterialLocalisationsDelegate(),
      ],
      supportedLocales: [
        Locale('en', 'US'), // English
        Locale('es', 'ES'), // Spanish
        Locale('pl', 'PL'),
        // ... other locales the app supports
      ],
      title: '@Voice Network Library', //_strings.title,
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or press Run > Flutter Hot Reload in IntelliJ). Notice that the
        // counter didn't reset back to zero; the application is not restarted.
        primarySwatch: Colors.indigo,
      ),
      home: NetLibsPage(),
    );
  }
}

Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v0.4.5-pre.52, on Microsoft Windows [Version 10.0.16299.431], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[!] IntelliJ IDEA Ultimate Edition (version 2018.1)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code, 32-bit edition (version 1.19.3)
[√] Connected devices (1 available)

! Doctor found issues in 2 categories.
like image 734
gregko Avatar asked May 19 '18 12:05

gregko


2 Answers

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

like image 84
Günter Zöchbauer Avatar answered Oct 23 '22 22:10

Günter Zöchbauer


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.

like image 32
Teddy Avatar answered Oct 23 '22 22:10

Teddy