Skip to content

Color codes in error messages are probably escaped when using the iOS simulator #20663

Open

Description

@kandarpksk

I'm adding ANSI color codes such as \u001B[31;1m (bright red) to error messages.
They render fine when using the Android emulator.
But with the iOS simulator, they seem to get escaped and appear as below:
**\^[[31;1m**Material widget ancestor required by TextField widgets not found.**<…>**

Activity

  1. changed the title [-]Color codes in error messages are probably escaped when using the iOS simulator[/-] [+]Color codes in error messages are escaped when using the iOS simulator[/+] on Aug 15, 2018
  2. kandarpksk commented on Aug 15, 2018

    @kandarpksk
    Author

    The color codes also get displayed in the form of weird characters in the red box (and text wraps at the edge of the screen instead of the edge of the red box – this is an unrelated "bug").

  3. kandarpksk commented on Aug 18, 2018

    @kandarpksk
    Author

    Also, the debugWordWrap function in /lib/src/foundation/print.dart will need to be updated to ignore color codes (when wrapping strings that are wider than the width of the terminal).

  4. added
    tool
    on Aug 18, 2018
  5. added
    platform-ios
    on Aug 20, 2018
  6. jacob314 commented on Aug 20, 2018

    @jacob314
    Contributor

    @pq who is working on logging with the Flutter IntelliJ plugin. It would be nice for that logging to also respect color escape codes.

  7. changed the title [-]Color codes in error messages are escaped when using the iOS simulator[/-] [+]Color codes in error messages are probably escaped when using the iOS simulator[/+] on Aug 20, 2018
  8. zoechi commented on Aug 21, 2018

    @zoechi
    Contributor

    I think @devoncarew

  9. kandarpksk commented on Aug 21, 2018

    @kandarpksk
    Author

    Attempted fixes for some of the other bugs mentioned:
    master...kandarpksk:colored_messages
    This is a demo app (click on the first button to recreate the sample error):
    https://github.com/kandarpksk/buggy

  10. pq commented on Aug 21, 2018

    @pq
    Contributor

    Thanks for this @kandarpksk. Great motivation!

  11. jacob314 commented on Aug 21, 2018

    @jacob314
    Contributor
  12. DanTup commented on Jan 28, 2019

    @DanTup
    Contributor

    This came up at google/ansicolor-dart#19 too.

    Given this code:

    void main() {
      final s2 = "\x1B[32m       test   \x1B[0m";
      final s3 = "\x1B[38;5;2m   test�   \x1B[0m";
      print(s2);
      print(s3);
      runApp(const GalleryApp());
    }

    Running flutter run from the terminal looks like this from an Android device:

    screenshot 2019-01-28 at 10 15 03 am

    But like this with the iOS Simulator (I don't have an iPhone to test there):

    screenshot 2019-01-28 at 10 15 32 am

  13. dan-rds commented on May 24, 2019

    @dan-rds
  14. ionutholbia commented on Jul 4, 2019

    @ionutholbia
  15. mkoorn commented on Jul 12, 2019

    @mkoorn

    watching this issue too. for now I prefix my logging with emoji ℹ️✅⛔️🤮

  16. 31 remaining items

  17. incrediblezayed commented on Nov 9, 2024

    @incrediblezayed
  18. nateshmbhat commented on Dec 8, 2024

    @nateshmbhat
  19. jdeepwell commented on Dec 8, 2024

    @jdeepwell
  20. Hannnes1 commented on Dec 10, 2024

    @Hannnes1
    Contributor

    Adding my comment from #64491, so that it doesn't get lost:

    I just noticed that the colors seem to work when running the app wirelessly on a real iOS device, but not on simulators or when attached with a cable.

    So the issue isn't limited to the iOS simulator.

  21. yanqianglu commented on Jul 17, 2025

    @yanqianglu

    Hi, I'm seeing the same issues (color works when running a real wirelessly-connected iphone, but not when running with iOS simulator). I don't see any resolution in all linked issues. I wonder if this is still on track to be investigated/fixed?

  22. jdeepwell commented on Jul 19, 2025

    @jdeepwell

    I also searched all over the net - nothing.

    All reports I found are closed
    #28856
    #13204

    Unfortunately I'm considering it very unlikely that this will be fixed - which is sad, as having the ability to add color to debug output (especially when running in the simulator) would greatly help in complex projects...:(

  23. mocki-toki commented on Aug 18, 2025

    @mocki-toki

    I regret that this issue hasn’t received attention from the Flutter team, as it seriously affects the convenience of debugging applications.

    If you need colored logs, I can suggest a workaround I found:

    1. Run the Flutter application in the terminal.
    Image
    1. Connect to the debug process started in the terminal through your IDE (in my case, VSCode)
    Image Image

    In this case, colors are displayed correctly, but hot restart only works through the terminal.

    Image
  24. JoakoV3 commented on Oct 8, 2025

    @JoakoV3

    Any updates on this issue?

  25. jubr commented on Apr 30, 2026

    @jubr

    Any updates on this in 2026? 🙏

  26. added a commit that references this issue on Aug 23, 2026
  27. khusantoy commented on Sep 8, 2026

    @khusantoy

    Experiencing the exact same behavior in 2026. Subscribing to this issue for updates—hope the PR fix gets merged soon!

  28. erlangparasu commented on Sep 9, 2026

    @erlangparasu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3customer: crowdfound in release: 3.0found in release: 3.1has reproducible stepsplatform-iosteam-iostooltriaged-ios

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions