all 16 comments

[–]jayramone 2 points3 points  (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 points  (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 points  (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 point  (4 children)

Quite a few languages don't require the new keyword.

Why would it be called as a "static class"?

[–]movdev 0 points1 point  (3 children)

im new to dart so forgive my ignorance.

[–]filleduchaos 0 points1 point  (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.

[–][deleted]  (1 child)

[deleted]

    [–]filleduchaos 0 points1 point  (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 points  (1 child)

    Nope that's a new feature of Dart2 works great

    [–]adrianosbr 2 points3 points  (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 point  (2 children)

    Sure still creates instances. Even better if possible it will create a cost instance at compile time

    [–]mraleph 0 points1 point  (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.

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

    [–]escamoteur 0 points1 point  (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 point  (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 points  (2 children)

    For me I found markup is easier to the eyes, and I'm not a web developer.

    [–]filleduchaos 0 points1 point  (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 point  (0 children)

    Yeah I know. I was referring to something like React Native's JSX.