31

The print() statement is not printing any data within Android Studio's console in Flutter iOS version, but same code works fine for flutter android version.

Here is the flutter Doctor summary:

[✓] Flutter (Channel master, v1.10.7-pre.109, on Mac OS X 10.14.6 18G103, locale en-IN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Community Edition (version 2019.1)
[✓] Connected device (1 available)

• No issues found!
Ahmet Sina Ustem
  • 1,090
  • 15
  • 32
Aravinth thiyagarajan
  • 2,193
  • 3
  • 12
  • 10

8 Answers8

41

I had the same issue. What worked for me was to add

import 'dart:developer';

to the top of my file, and then use

log('your message here');

instead of print.

Bianco
  • 531
  • 3
  • 4
10

you should try

debugPrint("")

to print in the console

Mo Ok
  • 544
  • 6
  • 20
10

had same issue... embarrassing said that I had my debug console filtered without realize it .. after I remove the filter text I could see all my print() and log()

saurabh
  • 6,687
  • 7
  • 42
  • 63
Claudio Moscoso
  • 329
  • 3
  • 5
4

I got the same issue.

As a workaround:

Select 'more actions' in the console, 'Open observatory' and the 'see debug' link. Then you can see the outputs of the print statements.

  • It is weird that it is happening after I updated it today. Your workaround helps, but I can't use vscode – carlosx2 Oct 23 '19 at 17:07
3

We stumbled upon it today and apparently the first line of some loggings doesn't appear. So if you start with a \n before your loggings it should work.

os_log("\n  We're using this")
Julian Horst
  • 805
  • 8
  • 15
1

In my case this happened because I changed the display name in Xcode from Runner to something else. Everything was working fine, but there was no log output.

TimSim
  • 3,936
  • 7
  • 46
  • 83
0

On pubspec.yaml change:

environment:
  sdk: ">=2.1.0 <3.0.0"

TO

environment:
  sdk: ">=2.6.0 <3.0.0"

Or high!

To more information visit Dart Diagnostic

0

For

[✓] Flutter (Channel stable, 2.10.3, on macOS 12.2 21D49 darwin-x64, locale en-NG)
    • Flutter version 2.10.3 at /Users/theodore_mca/softwares_and_sdks/flutter2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (6 days ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

Or Later

import 'dart:developer';

log("Theodore");

For regular strings

import 'dart:developer';

  final Map<String, dynamic> value = {"email2":'_emailController.text',};
  value.addAll({
              "email":'_emailController.text',
               "username":'_usernameController.text'});
  
  log(value.toString());

For complex Data Type

THEODORE
  • 917
  • 10
  • 12