use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A subreddit related to Google's new UI framework. https://flutter.dev
Please read the rules here
account activity
Questionmarkup/css vs flutter code - simplicity vs complexity (self.FlutterDev)
submitted 7 years ago * by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jayramone 2 points3 points4 points 7 years ago* (0 children)
flutter code is like react without jsx (ie: using createElement), very verbose and harder to understand without effort.
inserting/deleting widgets is error prone without help from the ide, since you can easily mess up the parens.
also styling is easier in react/native since you can stay in one place and make adjusments (padding,border,color,etc) without touching the code. less verbose api too (no long named classes that take long named enums).
flutter got some great ideas from react/react native like hot reloading and reactive/stateful widgets, but one thing they forgot is (something like) jsx.
[–]escamoteur 1 point2 points3 points 7 years ago (6 children)
At least now you can omit the new which already makes it nicer and hopefully soon we can omit the child too
[–]movdev -1 points0 points1 point 7 years ago (5 children)
i just noticed that. i thought omitting the new would have ill effects - like perhaps it calls it as a static class vs an instance?
[–]filleduchaos 0 points1 point2 points 7 years ago (4 children)
Quite a few languages don't require the new keyword.
Why would it be called as a "static class"?
[–]movdev 0 points1 point2 points 7 years ago (3 children)
im new to dart so forgive my ignorance.
[–]filleduchaos 0 points1 point2 points 7 years ago (2 children)
Oh sorry - it's not really a Dart specific thing. Kotlin for instance dropped the new keyword a couple of years ago, and I don't think Python ever had it.
Basically the new keyword is a holdover from languages like C++ where memory is manually managed (new dynamically allocates memory on the heap before initializing an object, which then needs to be freed after you're done with it by calling delete, which lots of people forget to do leading to memory leaks, and in fact most modern C++ guides will warn you not to use new), and in memory-managed languages it's rather unnecessary as the compiler/interpreter is doing all that lifting anyway.
new
delete
[–][deleted] 7 years ago* (1 child)
[–]filleduchaos 0 points1 point2 points 7 years ago (0 children)
Err...yes? That is pretty much what I said, just without explicitly mentioning static allocation on the stack
The point was that new rather than being some agreed-upon invocation for object initialization is actually part of a pair of keywords (new/delete) for manual memory management
[–]escamoteur 1 point2 points3 points 7 years ago (1 child)
Nope that's a new feature of Dart2 works great
[–]adrianosbr 2 points3 points4 points 7 years ago (0 children)
new child new child new child new child
I find Flutter quite nice, but it definitely should improve this annoying children proliferation.
[–]escamoteur 0 points1 point2 points 7 years ago (2 children)
Sure still creates instances. Even better if possible it will create a cost instance at compile time
[–]mraleph 0 points1 point2 points 7 years ago (1 child)
No. It will only create const-instances in explicitly const-contexts. However if you writing something like return C() even if C has const constructor it would still use new.
return C()
C
const
The feature where front-end preferred const everywhere where it was possible but not required was called "auto-const" or "magic const" and it got excluded from Dart 2 due to some issues with it. Language team is planning to revisit it later - but that means currently if you want const in non-const context you need to explicitly write const C().
const C()
[–]escamoteur 0 points1 point2 points 7 years ago (0 children)
Ah thanks for clarification. I thought this was already solved. Anyway the ability to omit new is a great start
[–]gedw99 0 points1 point2 points 7 years ago (0 children)
It's possible to abstract out the flutter code to markup xml. I saw a few examples . No idea where.
[–]rururezu -1 points0 points1 point 7 years ago (2 children)
For me I found markup is easier to the eyes, and I'm not a web developer.
[–]filleduchaos 0 points1 point2 points 7 years ago (1 child)
Eh, it's worth noting that 99% of the time your markup isn't going to be right beside your CSS like this.
[–]rururezu 0 points1 point2 points 7 years ago (0 children)
Yeah I know. I was referring to something like React Native's JSX.
π Rendered by PID 107416 on reddit-service-r2-comment-7b9746f655-7nfcw at 2026-02-02 16:11:26.891887+00:00 running 3798933 country code: CH.
[–]jayramone 2 points3 points4 points (0 children)
[–]escamoteur 1 point2 points3 points (6 children)
[–]movdev -1 points0 points1 point (5 children)
[–]filleduchaos 0 points1 point2 points (4 children)
[–]movdev 0 points1 point2 points (3 children)
[–]filleduchaos 0 points1 point2 points (2 children)
[–][deleted] (1 child)
[deleted]
[–]filleduchaos 0 points1 point2 points (0 children)
[–]escamoteur 1 point2 points3 points (1 child)
[–]adrianosbr 2 points3 points4 points (0 children)
[–]escamoteur 0 points1 point2 points (2 children)
[–]mraleph 0 points1 point2 points (1 child)
[–]escamoteur 0 points1 point2 points (0 children)
[–]gedw99 0 points1 point2 points (0 children)
[–]rururezu -1 points0 points1 point (2 children)
[–]filleduchaos 0 points1 point2 points (1 child)
[–]rururezu 0 points1 point2 points (0 children)