print() statement not printing to console in flutter iOS app within Android Studio

Viewed 24840

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!
8 Answers

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.

you should try

debugPrint("")

to print in the console

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()

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.

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")

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.

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

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

Related