Skip to content

Unreadable error message, red font in powershell #49444

Closed

Description

@bradyt

Steps to Reproduce

  1. Run
flutter create bug
cd bug
flutter run -d chrome
  1. Update the files as follows: Add var c = 1 + 'a'; in a widget build.
  2. Press R in powershell

Expected results: readable font colors in errors

Actual results: unreadable font colors in errors

Here is a screenshot,

Capture

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    a: qualityA truly polished experience
    on Jan 24, 2020
  2. zanderso commented on Apr 30, 2020

    @zanderso
    Member

    Oh, wow, that does look bad. The tool probably can't detect the current terminal background color in a general way, and even if it could, I'd worry that it wouldn't be able to make a smart choice about whether to enable colors. I suspect the best we could do is provide a global command line flag to disable terminal colors.

  3. mdudek commented on Jun 18, 2021

    @mdudek

    Fix it please, it's really annoying when you have to copy/paste every console output to the notepad to resolve the error.

  4. huycozy commented on Jul 12, 2022

    @huycozy
    Member

    Hi, this issue is still reproducible on the latest stable and master channels.

    Demo

    image

    Sample code
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          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 simply save your changes to "hot reload" in a Flutter IDE).
            // Notice that the counter didn't reset back to zero; the application
            // is not restarted.
            primarySwatch: Colors.blue,
          ),
          home: const MyHomePage(title: 'Flutter Demo Home Page'),
        );
      }
    }
    
    class MyHomePage extends StatefulWidget {
      const MyHomePage({Key? key, required this.title}) : super(key: key);
    
      // This widget is the home page of your application. It is stateful, meaning
      // that it has a State object (defined below) that contains fields that affect
      // how it looks.
    
      // This class is the configuration for the state. It holds the values (in this
      // case the title) provided by the parent (in this case the App widget) and
      // used by the build method of the State. Fields in a Widget subclass are
      // always marked "final".
    
      final String title;
    
      @override
      State<MyHomePage> createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      int _counter = 0;
    
      void _incrementCounter() {
        setState(() {
          // This call to setState tells the Flutter framework that something has
          // changed in this State, which causes it to rerun the build method below
          // so that the display can reflect the updated values. If we changed
          // _counter without calling setState(), then the build method would not be
          // called again, and so nothing would appear to happen.
          _counter++;
        });
      }
    
      @override
      Widget build(BuildContext context) {
    
        var c = 1 + 'a';
    
        // This method is rerun every time setState is called, for instance as done
        // by the _incrementCounter method above.
        //
        // The Flutter framework has been optimized to make rerunning build methods
        // fast, so that you can just rebuild anything that needs updating rather
        // than having to individually change instances of widgets.
        return Scaffold(
          appBar: AppBar(
            // Here we take the value from the MyHomePage object that was created by
            // the App.build method, and use it to set our appbar title.
            title: Text(widget.title),
          ),
          body: Center(
            // Center is a layout widget. It takes a single child and positions it
            // in the middle of the parent.
            child: Column(
              // Column is also a layout widget. It takes a list of children and
              // arranges them vertically. By default, it sizes itself to fit its
              // children horizontally, and tries to be as tall as its parent.
              //
              // Invoke "debug painting" (press "p" in the console, choose the
              // "Toggle Debug Paint" action from the Flutter Inspector in Android
              // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
              // to see the wireframe for each widget.
              //
              // Column has various properties to control how it sizes itself and
              // how it positions its children. Here we use mainAxisAlignment to
              // center the children vertically; the main axis here is the vertical
              // axis because Columns are vertical (the cross axis would be
              // horizontal).
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                const Text(
                  'You have pushed the button this many times:',
                ),
                Text(
                  '$_counter',
                  style: Theme.of(context).textTheme.headline4,
                ),
                TextField(),
              ],
            ),
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: _incrementCounter,
            tooltip: 'Increment',
            child: const Icon(Icons.add),
          ), // This trailing comma makes auto-formatting nicer for build methods.
        );
      }
    }
    
    flutter doctor -v
    [√] Flutter (Channel stable, 3.0.4, on Microsoft Windows [Version 10.0.19043.1766], locale en-US)
        • Flutter version 3.0.4 at C:\WIP\flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 85684f9300 (5 days ago), 2022-06-30 13:22:47 -0700
        • Engine revision 6ba2af10bb
        • Dart version 2.17.5
        • DevTools version 2.12.2
    
    [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
        • Android SDK at C:\AndroidSDK
        • Platform android-32, build-tools 32.0.0
        • ANDROID_HOME = C:\AndroidSDK
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.5)
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
        • Visual Studio Community 2022 version 17.2.32616.157
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2021.2)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    
    [!] Android Studio (version 2022.1)
        • Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        X Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [√] VS Code (version 1.68.1)
        • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.42.0
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1766]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 103.0.5060.66
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 101.0.1210.53
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
    [√] Flutter (Channel master, 3.1.0-0.0.pre.1593, on Microsoft Windows [Version 10.0.19043.1766], locale en-US)
        • Flutter version 3.1.0-0.0.pre.1593 on channel master at C:\WIP\flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 40fc5e86d8 (15 minutes ago), 2022-07-11 05:05:06 -0400
        • Engine revision 2b5d5c3b2d
        • Dart version 2.18.0 (build 2.18.0-271.0.dev)
        • DevTools version 2.15.0
    
    [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
        • Android SDK at C:\AndroidSDK
        • Platform android-32, build-tools 32.0.0
        • ANDROID_HOME = C:\AndroidSDK
        • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
        • All Android licenses accepted.
    
    [√] Chrome - develop for the web
        • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.5)
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
        • Visual Studio Community 2022 version 17.2.32616.157
        • Windows 10 SDK version 10.0.19041.0
    
    [√] Android Studio (version 2021.2)
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    
    [!] Android Studio (version 2022.1)
        • Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1
        • Flutter plugin can be installed from:
           https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
           https://plugins.jetbrains.com/plugin/6351-dart
        X Unable to find bundled Java version.
        • Try updating or re-installing Android Studio.
    
    [√] VS Code (version 1.68.1)
        • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.44.0
    
    [√] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.1766]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 103.0.5060.114
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 101.0.1210.53
    
    [√] HTTP Host Availability
        • All required HTTP hosts are available
    
    ! Doctor found issues in 1 category.
  5. added
    P3Issues that are less important to the Flutter project
    on Jul 12, 2022
  6. starwarsfan commented on Jul 22, 2023

    @starwarsfan

    Any news here? This is still very annoying...

  7. zanderso commented on Jul 24, 2023

    @zanderso
    Member

    FYI @eliasyishak since this is related to upcoming a11y work. This also reminds me that one option along these lines is for the tool to respect the NO_COLOR env variable à la https://no-color.org/

  8. hitman-codehq commented on Aug 21, 2023

    @hitman-codehq

    An easy solution is simply to use highlighted (bright) text for all coloured ouput. I had the same issue with git and that solution worked just fine.
    You don't need to come up with a "fancy" solution to try and detect the background colour of the terminal because by default, it's black, and it's always been black for as long as I can remember (at least if you open a terminal with the cmd.exe command).
    If you do want to get "fancy", then providing an ability for the user to configure the text colours in a way similar to what is done using git (you just edit the .gitconfig file) would be useful.

  9. self-assigned this
    on Jun 27, 2025
  10. added
    tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.
    on Jun 30, 2025
  11. github-actions commented on Jul 24, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projecta: qualityA truly polished experiencefound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions