logging
logging copied to clipboard
dart:developer log is inconsistent between IDE's and platforms
I was experimenting with ANSI colors in log to create a new logging package, using both print and dart:developer/log functions.
I found some inconsistences:
-
dart:developer.logdoesn't work at all in web platform. Nothing is printed. (print works just fine). Console also doesn't work (meaning: running in a console usingflutter run) -
Consoles (including VSCode console) shows ANSI color for both
printandlog, but Android Studio only shows color forprint.
Example code:
const greenForeground = "\u001b[32m";
const yellowBackground = "\u001b[43;1m";
const resetColor = "\u001b[0m";
print("${greenForeground}${yellowBackground}This is print with green foreground and yellow background.${resetColor}");
log("${greenForeground}${yellowBackground}This is dart:developer.log with green foreground and yellow background.${resetColor}");
VSCode output for MacOS (and maybe Android, iOS, Linux and Windows):

Same for Android Studio Electric Eel (#AI-221.6008.13.2211.9477386) (notice log doesn't work with ANSI codes)

Running on Chrome:
This is VSCode:

This is Chrome console (missing the log entry and also the green color should be dark, not bright (considering ANSI 16 colors specification)):

Running on console (default MacOS Terminal app) (Notice here is the wrong yellow (should be brighter, and log is missing)):
MacOS build:

Web build:

Considering print is limited (specially on Android), dart:developer should provide a better cross-platform log option that is reliable no matter the platform it is running =(
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6.2 21G320 darwin-x64, locale en-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.75.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!
https://issuetracker.google.com/issues/288641191 i Have same issue and i recommend you to raise issue here : https://github.com/flutter/flutter-intellij/issues