print command is adding extra new lines to every output in the console for iOS
See original GitHub issueSteps to Reproduce
Extra new lines are added after every print statement in the console.
Code Sample
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
print("counter = $_counter");
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Expected results
...
flutter: counter = 0
flutter: counter = 1
flutter: counter = 2
...
Actual results
Launching lib/main.dart on 6s in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: ***
Running Xcode build...
Xcode build done. 34.0s
Installing and launching...
Waiting for 6s to report its views...
Debug service listening on ws://localhost:60847/ws
Syncing files to device 6s...
flutter: counter = 0
flutter: counter = 1
flutter: counter = 2
flutter: counter = 3
...
Version info
flutter doctor output
[✓] Flutter (Channel stable, 1.20.0, on Mac OS X 10.15.5 19F101, locale en-IN)
• Flutter version 1.20.0 at /Users/***/Library/flutter
• Framework revision 840c9205b3 (33 hours ago), 2020-08-04 20:55:12 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/***/Library/Android/sdk
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/***/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 47.1.3
• Dart plugin version 201.8538.45
[✓] IntelliJ IDEA Community Edition (version 2019.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 39.0.3
• Dart plugin version 191.8580
[✓] VS Code (version 1.35.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.2.0
[✓] Connected device (2 available)
• A0001 (mobile) • *** • android-arm • Android 6.0.1 (API 23)
• 6s (mobile) • *** • ios • iOS 13.5.1
• No issues found!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Why does the print syntax append a \n at the end of a line?
When I run the following command in xCode 7.1, it appends \n at the end of the print command (Displayed in the output...
Read more >print without newline in swift - Stack Overflow
Starting in Swift 2.0, the recommended method of printing without newline is: print("Hello", terminator: "").
Read more >print(_:separator:terminator:) | Apple Developer Documentation
The output from each call to print(_:separator:terminator:) includes a newline by default. To print the items without a trailing newline, pass an empty ......
Read more >How to print content to the console without a new line in Swift ...
Learn why since Swift 3, the print function automatically adds a new line to the output and how to prevent this behaviour.
Read more >How to add a new line | Flexiple Tutorials | Python
In programming, it is a common practice to break lines and display content in a new line. This improves the readability of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried it on a couple of iPhone devices. Another weird thing -
Also see this comment - https://github.com/flutter/flutter/issues/63082#issuecomment-669958023. It seems @TahaTesser was able to repro this as well (perhaps on iPhone 11 simulator with iOS 13.6, as per their flutter doctor)
This has now been fixed.