Comments (5)
Tagging @matanlurey since he told me to do so
from flutter.
Using debugPrint
or surrounding print with if (kIsDebug)
isn't even the same behavior though.
Problems:
debugPrint
has nothing to do with other uses of the prefixdebug
in the framework, which imply debug mode.- The default
print
could be fixed in the Flutter embedder (read: not require zones) to make debugPrint unnecessary - It's not clear to users when to use
dart:developer#log
, which is also part of the API that ships with Flutter
from flutter.
Appreciate you filing this.
I don't have the authority to make such a change, but here is what I would do if I did:
- Override
print
in the Flutter embedder to work the waydebugPrint
does today - Deprecate
debugPrint
(for the time being, have it just forward toprint
)
That would bring us down to 2 ways to do things - one that always works in every mode and device - and one for debug only. I expect folks would likely write higher-level utilities on top, but at least the core functionality in dart:*
would work in a reasonable manner.
@darshankawar I don't think this is team-engine
(yet), it's true the change would need to happen in the engine, but the framework team would need to sign off on the changes (and, in my proposal above, agree to deprecate debugPrint
).
from flutter.
From the framework's point of view you should be using debugPrint
(this is also enforced with the avoid_print lint, which is part of the recommended lint set for flutter). By convention (like anything starting with debug*) it should only be called from a debug context (i.e. within an assert or guarded by if (kIsDebug)
), see also its documentation. It solves the throttling problem on some platforms and makes it really easy to intercept logs in tests (without requiring the use of error-prone zones).
I guess, it is not clear to me what problem this issue is describing that needs to be solved?
from flutter.
debugPrint. The name suggests that it will only log to the console in debug mode, but nope; it’s nothing to do with whether you’re in debug of release mode. Massive foot gun for people new to Dart. I suspect a lot of Dart apps are leaking all sorts of info because of this…
from flutter.
Related Issues (20)
- ListTile widgets when added as a children in ListView widget is scrolling outside its predefined space HOT 1
- I would like clarification on material 3 support in flutter HOT 4
- Flutter should log errors in vkCreateInstance HOT 1
- Migrate ButtonBar use in assets-for-api-docs/packages/diagrams/lib/src/card.dart
- mac-3 low on disk space. HOT 4
- 'Multiple widgets used the same GlobalKey' on Hot Reload When Using ShellRoute with Global Key and Builder Parameter HOT 8
- After upgrading to 3.22 Flutter Web ignores the -no-web-resources-cdn config HOT 11
- Improve fidelity of `CupertinoCheckbox`
- Web Build Busted After Upgrade HOT 5
- App gray mode HOT 3
- The argument limit does not work on Android
- [image_picker] pickMultiImage: The argument limit does not work on Android HOT 1
- Failures-only reporter for `flutter test`
- performance issue in flutter 3.22 on android platform HOT 7
- Version 3.22.0 does not support Windows 7 HOT 2
- [tool_crash] _TypeError: (#0 BuildAuroraCommand.runCommand (package:flutter_tools/src/commands/build_aurora.dart:78:50)) HOT 1
- getting platform exception while using HOT 1
- 3.22.0 Flutter Web Error using await HOT 2
- [local_auth] isDeviceSupported() behavior not clear HOT 4
- Clipping image to a circle sometimes reverts to a square HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter.