r/FlutterDev • • Dec 27 '21

Discussion I am not enjoying Flutter

Nobody Likes a rant, but Flutter is the one tool where every time I want to learn a little bit more... it pushes back hard. "No stay it your lane! Make simple little GUI stuff! Don't try to get fancy!"

Here is my abbreviated list of pain points.

1.) As they update Flutter, they keep introducing changes that break old code. If you want to google a working example, you presently have to filter for things written April 2021 or later. Anything before that won't compile. And then you end up trying to explain to the sample code how things work rather than the other way around.

2.) The Flutter community is small and too spread out. The flutter pages list 9 different places where you can get help with questions (including here) the problem is that none of those locations has the critical mass needed for the whole thing to work. There are more un-answered Flutter question on Stack overflow than ones with answers. If you ask about a unique edge case, non-one knows the answer... because there are probably only 6 people who encountered that exact same issue and found a solution.

3.) Way too much core functionality has been left out, hoping that community contributed packages will pick up the slack (Background services?). While the process of adding packages is very user friendly... there is almost zero policing of the published packages. There are hundreds of packages that are not being maintained and do not work with the current version of Flutter. So now everytime I import a package I need to wonder: Will this package still be around in 6 months? Am I setting myself up for some serious pain down the road? All I have to go by: How recently was it updated, how many likes does it have?

4.) Flutter/Dart feels like a project run by the kind of people who will ask you to invert a binary tree during and interview... even though their company doesn't use trees in any project. By that I mean: it feels unnecessarily complicated. Who thought Navigator 2.0 would catch on, or JSON -> Object in 4 non-easy steps was perfectly normal. And it's getting worse, didn't buttons used to have a simple color: property... and now you need to write:

TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.blue),
 ), ...

I still use Flutter, I still intend to use Flutter in the future. But I'm not enjoying it.

280 Upvotes

103 comments sorted by

605

u/Hixie Dec 28 '21 edited Dec 28 '21

Hello, Flutter TL here. Sorry to hear you're not enjoying using Flutter. In general I would encourage you to file bugs for your pain points, especially the more actionable ones.

Re the ones you listed:

1: I originally planned to have a "no breaking changes ever" policy for Flutter, but we got a huge amount of push-back from the community at large (as mostly represented by the quarterly surveys you may have seen). The majority of the community (by quite a large margin) was really eager that we continue to break things anytime we thought we could improve them at the same time. So that's why we're breaking you all the time. (I come from a web background, where we were super paranoid about ever breaking anything because a web page from 1992 should keep working now thirty years later, so this was a big culture shift for me, frankly.)

We do have a solution here though. If you submit your tests to our tests registry we guarantee that we will not break your code (or at least that we will submit patches to fix it if we do). I personally use this for one of my projects that I wrote three years ago, and the result is that it still works today even though I haven't touched it in two years.

Even if you can't contribute your own code (e.g. because it's proprietary) you can still submit the tests for the packages you depend on, so that we won't break those. You can also submit tests for tutorials you use, etc. The more code is submitted, the more likely it is that we will also not break code that isn't submitted.

If you have a lot of tests, you can also apply to join our program where we run your tests in CI as a separate shard on your hardware without you having to contribute the code itself. Google has actually contributed literally tens of thousands of tests in this way -- for example, we run all of GPay's tests with every commit, and so we can't make changes that would break GPay (or, alternatively, we work with the GPay team to fix their code first; ask me about PR #89451 sigh). So far no other big company has contributed tests in this way, but we are open to it. (It does require also contributing someone to work with us on a day to day basis to keep the tests running and to track down the sources of failures, since we couldn't see the code in this scenario.)

2: We do list 9 different places, you're right. We should probably clean that up. The reality is of the nine there's really only two or three big communities; the r/FlutterDev community is listed twice (once as Reddit and once as Discord), and StackOverflow is the other big one. I've taken a note to see if we can clean that up when I get back from vacation. This is good feedback, thanks.

3: We have some curating here with the Flutter Favorites program but you're right that choosing dependencies is hard. I'm open to ideas on how to improve this. ("Google should contribute more to Flutter so that it does more out of the box" is unfortunately not an option I have available, nor is "Google should review every package uploaded to pub.dev". Fundamentally Flutter is an open source project and while Google does contribute a few dozen full-time people across various roles to the project, as well as contributing its name to lend the project credibility, there is a limit to how much Google can spend here before bean counters start asking what exactly we're getting back beyond good will, heh.)

4a: Router is actually quite useful when the problem you're trying to solve is "how do I manage my navigation stack using my app state as the source of truth" (as opposed to having to manage it using the imperative API that Navigator exposes). That said, if that's not a problem that you are facing, you should IMHO stick with Navigator.

At the end of the day, Router and Navigator are just widgets and you don't actually have to use either. (Navigator is necessary if you're going to use dialog boxes and other widgets that need a Navigator to show their pop-up UI, but that's about it.) I often will write applications that don't use Navigator or Router at all, especially in embedded scenarios.

4b: Yeah JSON and Dart really don't mesh well (frankly it's not limited to Dart, most strongly typed languages have trouble with JSON's loosy-goosy approach because the whole point of a type system is to prevent exactly the kind of code that JSON begs for). The good news here is that we're actively working on Dart language changes that should address this. Look for updates about that next year, probably after the summer (we're being SUPER CAREFUL with these changes because they have the potential to make everything worse).

4c: Yeah, the button colouring thing is a bit unfortunate. The underlying problem is that saying a button is green isn't really enough, because buttons have so many different colours (normal, disabled, hovered, pushed, focused, combinations of those). That said, there's a trick that makes it slightly cleaner, namely using styleFrom, which is used something like this:

TextButton(
  style: TextButton.styleFrom(primary: Colors.blue),
  ...

See the API docs for more details.

Anyway, my core answer is just: file bugs, or click the "thumbs up" button on existing GitHub issues. Make sure to send feedback on the quarterly surveys. We (Google, not necessarily other Flutter contributors) actually base everything we do on feedback from the wider community.

I personally really want to make Flutter something that is fun to use, so this kind of feedback is really valuable. Please don't hesitate to reach out to me by e-mail ([email protected]) if you have ideas on how to make Flutter more fun to use.

125

u/user_namec_hecks_out Dec 28 '21

Thank you for taking the time to write this, but also for your contribution to Flutter!

121

u/JapanEngineer Dec 28 '21

The most respectful, polite, educated and all round awesome response anyone could ask for.

Thanks for all your hard work. I’ve enjoyed everything about Flutter except xcode which has nothing to do with flutter since I started using flutter May this year.

-5

u/[deleted] Dec 28 '21

You don't need xcode to write code with flutter.

5

u/JapanEngineer Dec 28 '21

I know. But you need xCode to build your schemes

4

u/[deleted] Dec 28 '21

4b has something to do with reflection?

25

u/Hixie Dec 28 '21

The potential solution I was referring to is our static metaprogramming effort which would allow for a compile-time reflection-like way to create JSON parsing and serializing methods on classes, so that you could take a JSON string and get out of it a parsed data structure. So basically parsing JSON would start looking more like "describe the data structure as a bunch of classes" (something like Kotlin data classes).

0

u/[deleted] Dec 28 '21

[deleted]

8

u/Hixie Dec 28 '21

Well the real target here is more like LISP macros, but yes.

0

u/[deleted] Dec 30 '21

[deleted]

2

u/Hixie Dec 30 '21

It's similar to what you can do with LISP macros.

0

u/[deleted] Dec 31 '21

[deleted]

2

u/Hixie Dec 31 '21

The static metaprogramming effort is about providing a way to expand code at compile time. It's certainly wildly different syntax and different core capabilities (it has to be; the power of LISP macros comes from the way that data and code are both represented as the same very simple core primitives, whereas in Dart the AST is as complicated as it is in most modern languages). The core idea though — take code, expand it into other code — is the same.

This effort is very much still in development, so if you have concrete proposals, please don't hesitate to write them up and propose them. Dart has an open language development process.

0

u/[deleted] Dec 31 '21

[deleted]

2

u/Hixie Dec 31 '21

By your definitions the current Dart proposals would enable both metaprogramming and macroprogramming, but we generally just refer to it as the "static metaprogramming" proposal.

FWIW, proposals like this evolve over time, and the behaviours they enable vary during that time, so it's not uncommon for their names to diverge from the actual proposed capabilities. I expect once we actually put this in the language it'll have entirely different names, but we haven't even started considering that yet; we're still designing the actual features, and testing them will probably take most of the coming year.

0

u/[deleted] Dec 31 '21

[deleted]

→ More replies (0)

10

u/esDotDev Dec 28 '21 edited Dec 28 '21

Regarding 4c, I think the OP makes a great point about overall complexity that the Flutter team seems to favor.

If you compare how flutter does it, with a basic unity button, I think this makes a clear constrast:https://docs.unity3d.com/Packages/[email protected]/manual/images/UI_ButtonInspector.png

It has far less features than the Flutter approach, but the API is clear, concise and easy to use, and is also more flexible at the same time.

The flutter codebase uses a ton of inheritence, base classes, mixins and complicated architectural schemes that really do make things quite hard to follow. Like whatever rabbit hole you go down, you end up backing out, because it's just become way to hard to grok how things fit together.

It feels like a lot of this is caused by (imo) the unfortunately tight coupling to the Material spec, which seems to have infiltrated the core component design at every turn, and forced you to come up with elaborate architectures to solve all the use cases. At the same time, ending up with very odd/limiting assumptions like "Apps primarily consist of full screen pages", which doesn't hold true on desktop or web, or even tablets, where apps are more typically a page, surrounded by scaffolding, like a menu or persistent title bar.

So after all is said and done, even with all of this complexity, we don't even get a simple system to serve the common use case of wrapping your pages in a persistent scaffold, or a simple button that we can just style.

I read this book recently, and remember thinking that I really wished the Flutter/Dart teams would read this as well: https://www.amazon.ca/Philosophy-Software-Design-John-Ousterhout/dp/1732102201, lots of good stuff in here about what _actually_ constitutes complexity, and also makes a good case against things like relying on throwing errors to report API issue as they are generally verbose, hard to use, and error prone. For example, using firstOrNull instead of first+error is a much more developer friendly API.

I really hope at some point, we end up seeing Material and Cupertino broken away from the core framework, and to see what the team could produce if they were freed from all of this baggage of complicated legacy requirements + mobile-tunnel-vision and could simply create a nice easy to use bag of cross platform vanilla components.

9

u/AlexandrFarkas Dec 28 '21

It's not just button. It's a Material Design button.If I want to use simple/custom button, I just spend 10 minutes of my time to write it, because it's easy.

If my designer uses Material UI, I would never complain about TextButton being that feature-rich.

7

u/[deleted] Dec 28 '21

Your entire post is around the concept of how much simpler "design" could be, but only point to the Unity button, that I don't understand how it's simpler? Just because it has less available options? Changing each of those individual parts are identical between the flutter way of handling it and the Unity way, I don't see how the Unity way is any simpler

9

u/esDotDev Dec 28 '21 edited Dec 28 '21

Well, like I said, the Unity button is "clear, concise and easy to use." Can you say the same about the new material buttons? Fundamentally, an API with a million options is a sign of a bad abstraction and an overly complex API.

It's simpler because it optimizes the API for the common case, and strikes a much better balance between power and simplicity. It is easily understood at face value, but still very powerful and flexible. You don't really need to read the docs for the Unity button, it's clear from reading the class definition exactly what everything does. Yet, I could use it to build virtually any button imagineable.

It would be the equivalent in flutter of something simple and straightforward like:

Button(
  color:
  colorHighlight:
  colorDisabled:
  backgroundBuilder:
  foregroundBuilder:
)

Which doesn't exist in Flutter. Instead we have 3 Material buttons and a Cupertino button, all with different options, very complex styling rules, and a verbose syntax. Why? Because they need to support a specific spec, and that spec introduces all sorts of opinionated and specific requirements. This forces the API to be complex, and drives it away from being simple and general purpose.

I think this fairly clearly shows the blind spot that the marriage to Material spec introduces, and the damage it has on the underlying API. In any other framework, they would start with a Button, that button would serve as the basis for any future buttons. A Material or Cupertino button would then be built on top of that core general purpose button.

In Flutter, they skip right past that, and we just get a set of highly opinionated, very complicated and specific buttons that are not only very hard to understand and style, but actively fight you when you try and customize them heavily. If you want a simple custom button that works properly (focusable, supports keyboard, etc), you have to bolt together like 3 or 4 existing widgets, which is really odd when you step back and think about it...tbf, the new buttons are much easier to fully customize, but in exchange, their API surface has exploded somewhat.

And you can see this same influence everywhere, especially with regards to how page routing works, it's somehow complicated, but also limiting at the same time. Limiting because it's optimized strictly for mobile devices that shows one fullscreen page at a time, but complex cause it supports complicated use cases like Hero animations, but not Hero animations in Overlays, because the material spec doesn't call for it :/ (yet?). Which is another example of the odd tunnel vision and design decisions that comes with basing everything so closely off of one spec. If you're going to have something like Hero, why wouldn't it work with Overlay? It's inexplicable, until you factor in the Material Spec, and then it all makes sense. They are really only building what the material spec needs, and then stopping there. If Material spec needs Overlays to have Heros tomorrow, then we'll get them eventually in Flutter... seems like a very odd place to be.

It also seems like a bad choice from a maintenance standpoint, as you are bound to an ever moving target, inevitably creating more and more cruft and complexity in the SDK (or outdated invalid tutorials if you just start deprecating everyting).

Sorry if this comes off as ranty, just honest opinions, I still love Flutter lots :)

8

u/Hixie Dec 28 '21

That's the API we had with RaisedButton (and the other buttons from that generation), but we moved away from it because it wasn't expressive enough to represent the kinds of UIs people wanted to build.

2

u/[deleted] Dec 28 '21

What kind of buttons do people want to make where the RasiedButton style was not enough but this MaterialStateProperty stuff is? If you need something super insane, shouldn't you be making your own custom widget at that point?

Not flaming, genuinely curious.

5

u/dancovich Dec 28 '21

Try creating a button that is yellow by default but turns red when pressed and a pinkish red when hovered with the old model.

1

u/senfiaj Dec 06 '23

The problem I see Flutter tries to solve complicated use cases in opiniated ways where most people don't need them, and when the do they are oftentimes different use cases where Flutter was not designed for them well.

A good API/Framework should be layered and provide as much control as possible. Simple things should be easy to implement, hard things should be hard, intermediate things should be between easy and hard. You can't design that works for the all complicated use cases, the only solution is to provide gradual levels of control.

1

u/esDotDev Dec 28 '21

The problem with raised builder is it did way too much. You could give it a child, but it was constantly fighting you with what it would do to that child. The example above uses builders to explicitly say, you can do whatever you want.

The colors would be applied as tints or something, to serve the most common use case. Then if you pass some info into the builders, like mouseIsOver, and isEnabled etc, we have a btn that should be extremely expressive. You could wrap it, ignore the color stuff, and do anything you want inside the builders.

2

u/Hixie Dec 28 '21

I encourage you to create a package that shows what a UniversalButton would look like, and then reimplement both the Material and Cupertino widgets using UniversalButton. Based on our experience, I suspect that either UniversalButton would be almost trivial (basically just GestureDetector, Focus, and Semantics combined with some Builders, a few lines of code that really doesn't save anyone any time if they're building a custom button), or it would be too opinionated to be useful.

(If I'm wrong, then that would be really useful information. We do keep considering building a general widget library like this, we just haven't figured out the value proposition yet. If you can demonstrate that there is value here that would be super useful.)

2

u/esDotDev Dec 28 '21 edited Dec 28 '21

Cool, I can give it a shot. It will end up pretty much as you describe though: " GestureDetector, Focus, and Semantics combined with some Builders", but I'd argue this is still very useful because these concepts like Semantics, Actions/Activators, MouseCursor and DebugInfo are not actually well known to most flutter developers.

So it might be trivial when you know how everything works, but it's also a big blind spot that most people will screw up when implementing themselves (from my experience). Most developers will just add a GestureDetector and maybe if they are more experienced, a MouseRegion or a FocusNode, and move on, thinking they have a working button. In reality, they're still missing a bunch of core button functionality that will bite them later when they move to new platforms or get bug reports from people using screen readers or keyboards.

It's also useful because it allows flutter team to add more core functionality to the SDK as it becomes available, and we get that for free, rather than having a bunch of custom buttons that get out of sync with evolving framework features. So for example, if Semantics every gets deprecated and replaced, anyone using CoreButton gets the fixes for free.

As mentioned, I think it's also useful because it frees up the material buttons to be less general purpose. They wouldn't have the same pressure to try and do all things for all people (as they do now), they could be more rigid, with less options, which simplifies their API considerably, so there could be some knock-on effect there where the existence of the core component, can help concentrate the API of the next level of abstractions.

This is analogous to HTML where we can use Button or Input and get all of these core functions (semantics, tab support, focus rect, mouse cursor, keyboard support etc) for free, but also have complete control to replace the contents of each button or input. Then more specialized btns and inputs are built on these fundamental layers. In flutter there is essentially no Input or Button abstraction at all, just SpecializedButtonA, SpecializedInputB, etc

3

u/Hixie Dec 29 '21

The disasters that are <button> and <input> are a lot of what drove us to Flutter's current design (the Flutter team founders were mostly folks from the web world reacting to a lot of the mistakes that the web made).

I think you're right that making a custom button requires knowledge about a bunch of things. I think it would make sense for there to be a guide on how to make accessible, cross-platform widgets like buttons in Flutter. I think that would be a lot more useful than an "unopinionated" widget set, though, because it seems to me that the exact order in which you need to compose the various parts that make a button are different for different buttons.

1

u/esDotDev Jan 25 '22 edited Jan 25 '22

Just to close the loop on this, here is basically what I would consider the "missing button primitive" in Flutter: https://pub.dev/packages/focusable_control_builder

This package builds on your `FocusableActionDetector` which is a nice step in the direction, but frustratingly, does not add a gesture handler or focus node in order to complete an actual "button".

The provides the complete structure for a button component (which is non-trivial), but is deliberately unconcerned with what it renders.

→ More replies (0)

1

u/senfiaj Dec 06 '23

What's wrong with <button> or <input>? They are super simple to customize. If you want complicated behaviour, you can also use JS. In web you have a lot of fine grained control.

Flutter tries to solve complicated use cases where most people don't need them, and when the do they are oftentimes different use cases where Flutter was not designed for.

→ More replies (0)

1

u/textzenith Jun 06 '23

Well, like I said, the Unity button is "clear, concise and easy to use." Can you say the same about the new material buttons? Fundamentally, an API with a million options is a sign of a bad abstraction and an overly complex API.

Please, please, please, don't anybody developing Flutter read this and take this seriously.

The joy of Flutter is having a ton of options for each widget that are easy to use.

In days of yore, it might have been complex and difficult. With modern LSPs, however, Dart's strict typing system and Flutter's in-depth documentation allow you to summon all the information you need in an instant.

You can dive right in and start using most Widgets without any preamble — just create the widget and e.g. Intellisense will show you all available props and how to use them. Easy as pie.

The pain of Flutter, mentioned by the OP, is that the framework is developing in a way that takes you out of the simple Widget mindset, demanding you to invoke MaterialProperties, strange generically-typed objects, and complicated systems like Navigator with a lot of obscure moving parts.

This is something the LSP can't show you and usually sets you off down the rabbit hole of frantically searching through dozens of inadequate online tutorials.

If you take complexity out of the "API" (i.e. widget properties, amazingly simple and delightful to use) and force it into the object / type system (which is bewildering, at the best of times), you will fudge things up.

I mean, I've used Flutter for years and still haven't got a clue how use ButtonStyles in an elegant way.

Seriously, don't pay heed to this idea. It's dangerous.

1

u/senfiaj Dec 06 '23

Man, this is my experience with Flutter. My impression is that Google thinks that all Flutter apps must look and behave like a Google app. Pretty much every app design I have been presented was very different from that.

One of the things that infuriates me is that there is no unified and consistent way for widget styling. For example why does Container has its own color property but also has color in decorator and why other widgets lack this color property? Why are some Text styles in the Text (such as overflow) but some styles are only in TextStyle (such as fontSize)?

Another very annoying thing is how Flutter handles focus. Flutter doesn't unfocus the input or selected text if you click outside of it, unless you click on other input or selectable of course. Today I was asked to make all the app text selectable. The selectable text behavior turned out to be so brain damaged that I genuinely wanted to beat the Flutter framework developers' half to death. Besides that the selected text was not unselected if I tap somewhere else, it didn't even unselect when I selected another selectable text. I need to tap on the same selectable text to unselect it. I had to write quite an mount of code to handle this BS.

And don't tell me about the akward way of showing menus when clicking on a text by positioning them with calculated insets from the text rendering box.

I genuinely think to leave any position related to Flutter and Mobile development, this is destroying my mental health. CSS / JS / HTML is a way more predictable, stable, peaceful, mature and controllable platform.

1

u/Phroneo Nov 23 '23 edited Nov 23 '23

Hi,

Not sure if you will see this but as someone who is trying to learn FLutter after somewhat mastering Corona SDK / Solar2D, the complexity of Flutter drives me up the wall. Every part of it feels overengineered when all I want to do is make a basic UI with somethings happening in between.

However, I don't feel that there are any alternatives with high level language. It's just this madness of referencing classes, inheritances and boiler plate code that makes no practical sense in its design.

Are there any high level alternatives?

As for your Unity button example, even on my first chapter in flutter, I've already started making custom functions to create text in that way because the inanity of even just setting color and fontsize (style: TextStyle(color: fColor, fontSize: fSize)) is demented tbh. Similar with styleFrom etc.

I imagine I will do the same with a lot of features. however, I miss the Solar2D ways where things just made sense and were simple. The main problem is that you can't really make something like an alarm clock. Background processing type stuff.

1

u/esDotDev Nov 23 '23 edited Nov 23 '23

Well, I'd say the saving grace of Flutter is how easy it is to make your own custom components. So if you stick to the lower level classes like Row, Column, Stack, Container etc, you can very quickly build any component you need and design it exactly as you like.

It's when you try and use the higher level abstractions that are tied into the material design spec that you really hit the frustrating mix of extremely high complexity with very low customizability.

For the most part you can avoid this, but unfortunately it has wormed it's way into some very core parts of the framework like route navigation, overlays, dialogs etc.

When it comes to text styles, we usually just define some static style variables, and then can do stuff like: Text('Hello', style: TextStyles.h1)

3

u/esDotDev Dec 28 '21

Regarding 4a, it's not really an option to ignore Router, because no simple mechanism has been provided to work with browser location history.

The problem with the rollout of Nav 2 imo, and I really hope the Flutter team learns from this, was not providing an implementation that was simple and easy to use for the common use case. imho, it should have just built on the functionality that came with `onGenerateRoute` but add full support for browser history. Under the hood it could use the Router API that remains as flexible as ever.

I know the rationale will come back as "We wanted to let the community do it", but this baffles me for a couple of reasons. 1) There is tons of prior art here, between React, Vue, Next etc etc, this has been solved many times. It should have been relatively easy to make a state of the art router, that pulled from these previous efforts. 2) It provided no clear upgrade path from Nav1 to Nav2, you went from being able to declare routes or use onGenerateRoute, to having to roll all of this by hand, just for the singular benefit of getting browser location support.

17

u/Hixie Dec 28 '21

If you're writing an app that works with the browser (and want to work with the history in the browser), then yeah, you'll need to either use Router or write your own version of it.

Router wasn't originally designed to solve that problem (we didn't even have web support on the cards when I first drew the whiteboard diagrams that led to Router). Router's purpose is to provide a declarative way to use Navigator, so that you can use the same React-like programming style with Navigator as you can with everything else.

The irony is I invented window.history.pushState when I was working on HTML, and I messed that up too (hence the second argument being a no-op).

Anyway, we're not done with Router and Navigator, and I'm sure we'll eventually come to a place where you can use an imperative API like Navigator while still getting the close integration with the browser history. It's just taking some time. (Navigator's API isn't viable for this because it has no way to express going "forward" again, and the API is so complicated already that there's no reasonable way to extend it to add that.)

BTW, we're moving away from the terms "nav1" and "nav2" because they're misleading and wrong. There's Navigator and Router. Router doesn't replace Navigator, it (usually) uses it. Navigator isn't going away, you can still use that too. They work together, even.

6

u/esDotDev Dec 28 '21 edited Dec 28 '21

Thanks for the reply! I actually really like the Router API, it's impressively flexible and actually relatively simple. It just shouldn't have been the API presented to developers to use directly (imo). You could've build something like React Router 6, on top of Router, and given developers that clear path forward from MaterialApp.routes. I do sometimes worry that the Flutter team doesn't look closely enough at existing prior art when designing things, if a API is on version six probably some it has condensed into something pretty good!

Luckily Chris just went ahead and wrote GoRouter, so maybe this discussion is moot now :)

Another example of this apparent lack of research on prior art, is the InteractiveViewer, which misses almost every option commonly expected in what is typically called a ScrollView or a ScrollPane component, not even letting you set simple things like easing. I did log a bug on this about a yr ago, fwiw: https://github.com/flutter/flutter/issues/71676

The explanation seems to be this fixation on the Material spec, when you dig into the source you find reference comments to it being built as a clone of Google Photos, which explains everything about why the API is so limited and oddly missing of basic config options. Would love if the Flutter team started taking a more wholistic look at things, and use Material components as one reference, rather than the reference. Especially when building universal components like InteractiveViewer, that are really not bound to any one design system.

It amazing to be able to talk directly to the TL of my favorite tech stack, so if you've read this far, thanks again for your time!

7

u/Hixie Dec 28 '21

The Googlers on the team definitely have a bias towards Material. It's not a fixation so much as that is what our employer is currently using as the standard design language, so it's natural that we'll be biased towards it. It's similar to how we're biased towards English and left-to-right, or biased towards Android. It's just a natural result of the environment we work in. (That's not excuse, just an explanation).

FWIW, when I designed the strawman that eventually led to Router, I did do a bunch of research. What I found was largely that the existing solutions didn't solve the problems I wanted to solve, hence the different design. (I definitely didn't look at React Router 6 since that came out a few weeks ago whereas I was designing this a few years ago.)

There's a pair of risks when designing new things: on the one hand there's the risk that existing solutions will influence you so much that your design is just a copy of what came before, not even an improvement, let alone something novel enough that it will be useful to anyone; on the other hand there's the risk that your solution will be so unusual that you miss the reasons why other people did things the way they did, and then you just repeat older mistakes and your thing again isn't useful to anyone. Striking the right balance is non-trivial.

Different parts of Flutter and Dart are built by different people, and each one of us has different experiences and different skills and different abilities to strike that balance and others. One of the things we tried to bake into the design from the start is that (especially for the framework) the components are largely independent, so that if some component isn't what people want, it can be seamlessly replaced by the end-developers. InteractiveViewer is an example of where this works well. If you don't like its current design, it's actually quite possible to just drop in a replacement that does what you want (either as a new widget or literally replacing it in your copy of the framework so it even affects other widgets that use it). Navigator is one of the examples where that's harder because it's used to trigger things like dialog boxes.

Anyway I think this componentization aspect is really important and is something that we've done much better than most other UI frameworks.

3

u/esDotDev Dec 28 '21 edited Dec 28 '21

Indeed, the componentization in Flutter is first-class and really saves the day in cases where you might be frustrated by one component or another. I love it!

I totally get the Material design relationship to Google, but I think that could still be served by taking a slightly different tact with component design. Instead of having the first concrete implementations be Material or Cupertino, whenever possible, make a concrete component that unopinionated and flexible, then configure it to be material/cupertino/whatever.

ie InteractiveViewer is designed consciously to be flexible and agnostic, all prior art is considered in terms of API surface, especially rich platforms like Flash and Unity. Then MaterialInteractiveViewer is just a quick wrapper, with some config options.

A lot of times what I see in the Flutter src that frustrates me, is an abstract class (like PageRoute) that is not actually useable, and then 2 opinionated concrete implementations, and it's just missing the middle link of the base component.

This leaves the developers in a tough place, as they need to either understand the abstract class + their implementations so they can write their own, which is a non-trivial task usually. Or, they have to try and "peel back" the opinions of the Material or Cupertino incarnation. Which is often just not possible.

Having that underlying universal component leaves developers in a much nicer place, as we can just go one level down if we want to lose the opinionated stylings or behavior, instead of having to roll our own component or dig into complex source code.

I really think it would drive a great 'dog food' cycle, where the team's own engineers were forced to use the universal components,to build the material stuff, and could log complaints when their use cases aren't served.

Also seems like it might ease implementation of the opinionated implementations. Authors can be more free with hardcoded values and such, as they are not attempting to be two things at once. They can narrow their API surface, making things more focused and easier to grok. If people want more options, you just say it's not to spec, and punt them to UniversalButton. Definitely would make it easier to separate out the Material/Cupertino components from the core SDK, but I guess that ship has probably sailed :D

Anyways, thanks for the chat, I totally didn't mean to write that much. Have a great new yr!

4

u/Hixie Dec 28 '21

I agree entirely with the theory, and that's what we try to do where it actually makes sense (e.g. EditableText, Scrollable, etc). In practice, I don't know how much you'd actually find in common between Material buttons, Cupertino buttons, Fluent buttons, Aqua buttons, etc. It sounds nice to say "have a UniversalButton widget" but in practice there's really not much beyond GestureDetector, Focus, and Semantics. (Seriously, compare the Material button implementation and the Cupertino button implementation and tell me what you would put in UniversalButton.) It's even more true as you get to more elaborate widgets like Sliders and Switches.

1

u/eibaan Dec 28 '21

For buttons I don't mind if there isn't a common code base because they are easy to recreate from scratch based on a gesture detector and focus widget.

However, the same isn't true for a scrollable pane, for example. IMHO, Flutter made the mistake to follow Android in having a ScrollView that can scroll in only one direction while iOS always provided a UIScrollView that supported both directions at the same time. So the interactive viewer widget was extracted from the Flutter example application as an afterthought but it isn't a "real" scrollable thingy and doesn't support scroll bars or keyboard navigation, AFAIK.

People who want to recreate a text field also have a hard time to recreate everything that has been done for material or cupertino and it would be nice if a more complete text field was part of the widgets layers.

Currently, I'm pretty sure, most developer use material as the foundation and then work "against" the material theming to create their look and feel and don't start with a pure widgets layer widget and construct their widgets from there. But I also don't know how to solve this or if that even needs solving…

3

u/Hixie Dec 28 '21

re scroll views, that's entirely my fault. When I refactored all our scrolling code, I could see a way to make scrolling handle fancy scroll effects in one dimension with lazy-loading support. But I couldn't (and frankly, still can't) see a good way to do this in two dimensions. The current tech lead for the framework has been thinking a lot about this and there's a good chance he'll find a way to do general 2D scrolling. (If you have any thoughts on how to do it, I encourage you to look at our contributing guide to find the link to our Discord, and then describe your idea in #hackers-framework.)

re text fields, if there's things that are duplicated in the Cupertino and Material text field widgets that could be moved to EditableText, file an issue.

1

u/esDotDev Dec 28 '21

What you described actually is missing core button functionality. Like it won't work with ENTER key, and it needs a mouse cursor as well.

Happily they did add FocusableActionDetector, which if you add a GestureDetector, and a bit of boilerplate code does basically get you a proper custom button.

1

u/esDotDev Dec 28 '21 edited Dec 28 '21

Well I think that's kinda the point, it would force the underlying button (or checkbox, or slider) to be very simple and flexible, because there just aren't going to be many worthwhile commonalities between Material and Cupertino or whatever, all that is left are the fundamental commonalities that all buttons would share. Maybe you make a few assumptions about common cases (like color tinting fg and bg), but these core components would be mostly a set of unopinionated builders and some logic/state.

So it's not like it should be loads of work to do... but it then gives us the same foundation that we can use to build our own custom btns. We get that useable base class, without having to dive deep into any src code.

fwiw, making a custom button, that works properly on desktop and web is not actually that simple, from my experience, most developers if asked to build one will probably miss something. It's certainly a bit better now with FocusableActionDetector.

3

u/remirousselet Dec 28 '21

[about json] The good news here is that we're actively working on Dart language changes that should address this. Look for updates about that next year, probably after the summer (we're being SUPER CAREFUL with these changes because they have the potential to make everything worse).

Is that about Metaprogramming? If not, where can I read about this? After all that would heavily impact package authors

1

u/Lord_Alpha_ Dec 29 '21

From another comment:

The potential solution I was referring to is our static metaprogramming effort which would allow for a compile-time reflection-like way to create JSON parsing and serializing methods on classes, so that you could take a JSON string and get out of it a parsed data structure. So basically parsing JSON would start looking more like "describe the data structure as a bunch of classes" (something like Kotlin data classes).

2

u/Fienases Dec 28 '21

I've been working as a Flutter developer for almost 3 years now and I just want to say that I love the experience that the Flutter ecosystem provides to us as a developer.

2

u/GingsWife Dec 28 '21

Your third point is very scary.

4

u/Hixie Dec 28 '21

I mean, it's true of everything corporations do. Google is actually significantly more generous with open source contributions than most companies.

Luckily for Flutter, Google is by far not the only contributor (not even the only corporate contributor).

2

u/reynir999 Dec 28 '21

I love Flutter. Thank you for your contribution!

1

u/aytunch Dec 29 '21

As to answer number 3: Google is the biggest winner here. Without RN and Flutter like technologies no startup will think about publishing to Google Play Store. If they want to compete with Apple in mobile stores, they need to give more importance to Flutter. You made it sound like Google is doing charity work.

6

u/Hixie Dec 29 '21

See my comment elsewhere in this thread -- it's a question of balancing the expected return with the investment.

charity work

I definitely wouldn't characterize open source contribution as charity work, but the link between investment and return is definitely harder to draw with open source work (and open standards work, which was my previous playground) than it is with closed-source engineering on a paid product. If you write, say, a AAA game, you can count the income from sales of the game and DLC, subtract what it cost to make it, and there's your profit (modulo taxes and such). With open source, you're giving away the work product. How do you measure the benefit? There's definitely some benefit to Google that comes from Flutter existing, but how do you quantify exactly what it is? How do you know that benefit wouldn't exist without Flutter (e.g. because React Native does the same thing)? If you invest more than the return, you're not going to be profitable. If you invest too little, then you're missing an opportunity.

I actually think Flutter developers are the biggest winner here by far, in terms of return on investment (i.e. in terms of the ratio between the benefit accrued and the cost to obtain that benefit). That's not to say that Google doesn't benefit, of course it does. But that doesn't mean it would benefit even more if it invested more.

Without RN and Flutter like technologies no startup will think about publishing to Google Play Store.

We've run that experiment, since the Play store predates React and Flutter. It turns out that hypothesis is incorrect.

35

u/kiwigothic Dec 28 '21

Not adding much to this conversation but FWIW I've been coding in flutter full time for quite a while now (and previously worked with other cross platform frameworks) and I really have to disagree on most of this.. if you compare the flutter ecosystem with competitors like React Native then most of your pain points are the same or worse (sometimes much worse).

Null safety was a challenge for sure but it also weeded out a lot of abandoned packages (not something unique to Flutter at all), I find the "likes" system along with the Null Safety filter to be quite helpful. Apart from that I have not had many issues with breaking changes over the last couple of years.

There are the odd deprecations that can be annoying but it's really a sign that the ecosystem is alive and healthy, Dart is continuing to improve at a very rapid pace which is good for everyone.

Of course it's not perfect (I agree with comments about MaterialStateProperty being weird for instance) but on balance I honestly believe Flutter is leagues ahead of any other cross platform technology and likely to increase that lead.

Overall I find Flutter to be a joy to use.

8

u/Badaluka Dec 28 '21

Try React Native and then compare. Maybe you are made to use the other one.

21

u/ShawnMilo Dec 27 '21

That sucks. But Flutter is still in the "early-enough" days that you can be a big player. You know -- the kind of person who writes Flutter books, gives Flutter talks at conferences, offers Flutter training, or has a popular Flutter blog or YouTube channel.

Obviously not today, but as you fight your way through the BS to "get there," you'll be prepared in a way newbies will be unable to duplicate because you did it "the hard way."

Everyone who is a "big name" in whatever technology (insert programming language, framework, automation system, etc. here) is someone who got involved early.

I know it doesn't solve (or even address) your problem. But you can make a positive out of a negative.

5

u/dancovich Dec 28 '21
  1. Apart from migrating to Flutter 2 (that was a annoying) I don't recall any update inside the same major version that broke anything. Maybe you mean a package got updated? Also, just run flutter downgrade and set your SDK to whatever version you need for it to work.

  2. I don't know what difficulty you're having. Both this community and r/flutterhelp are very helpful. Can you give one example of question that you never got an answer to?

  3. What do you consider core? I don't know of any feature Dart misses and Flutter has everything I consider core to an UI framework (which is what Flutter is). Any functionality that works differently depending on the platform (camera, Bluetooth, GPS and so on) NEED to be on a package because these functionalities sometimes differ in implementation depending on the platform.

  4. Changes are necessary if you want your framework to stay with the times. Native Android changes all the time. iOS had an entire language change from Objective C to Swift (I know, you can still use ObjC, but more and more components are written in Swift and require it), React introduced a whole new concept of hooks (which some components annoyingly use exclusively, requiring that you use them too because they don't work with classes) and so on.

And it's not like you were left with your hands hanging. Navigator 1.0 still works - Navigator 2.0 isn't even an update, it's just a badly named different API to deal with the same issue. You can still use 1.0 with no deprecation warnings.

As for the button, they dedicated an entire page to explain the change. It's here: https://docs.flutter.dev/release/breaking-changes/buttons. As a general guideline, you can just use TextButton.styleFrom() to stylize your buttons, it's very similar to the old way.

There are not that many breaking changes in Flutter. Navigator isn't breaking (old one still works, isn't deprecated and probably won't ever be), so they usually write articles explaining the reason of the change when the changes are breaking. They also post it here, so I recommend you visit this sub to stay informed.

I still use Flutter, I still intend to use Flutter in the future. But I'm not enjoying it.

It's ok to not be enjoying it, but your reasons depicted here feel strange to be, because you didn't really gave any examples that wouldn't happen in any other framework. All mobile and web frameworks I know of have these exact issues - even the "seek help" issue happens in frameworks considered popular, because as these evolve old answers get outdated with no info of what the alternative is. I daily lose considerable amounts of time seeking the CORRECT answer for a React question, because answers spread around are outdated or not the best advice for today's standards.

18

u/ObsceneElbows Dec 28 '21
  1. break code? i mean, ive been using flutter for a few years now. Null safety update did not break things. Buttons update did not break things. Sometimes it updates but its not usual to break, in my experience (not considering package updates)

  2. agree, but that matures with time. and i believe flutter is growing fast

  3. you probably should to use few packages on your projects because its "bad" to have many dependencies. thats not flutter exclusive, tho. but the packages that you really need (like state management and some other things) are pretty solid already

  4. the button style update was kind of weird. i think they are trying to change how you do style on apps (still better than anything like css). but MaterialStateProperty is very weird. it doesnt even feel like flutter

5

u/dancovich Dec 28 '21

For point 4, the change had two objectives:

  1. They want to standardize how themes are defined on ThemeData. Before some properties were specific (like having a scaffoldBackground property directly inside ThemeData) while others were instances of [ComponentName]ThemeData, with specific properties regarding that specific component. They want to change ThemeData so ALL specific properties are inside these [ComponentName]ThemeData classes, so instead of having a property scaffoldBackground, they have a property scaffoldTheme that is a ScaffoldThemeData and that class has the background color for Scaffolds.

For buttons, unfortunately the old components were too stuck in this old way of thinking. Changing them would break too much, so to not make it a breaking change they deprecated the old components (but they still work) and created new ones following their new philosophy.

2) Buttons didn't have an easy way to customize some aspects of it. For example, it wasn't possible to have a button with different colors for it's states, it always followed Material Design, that always use the same color but with different shades depending on state. The new buttons allow you to not follow Material Design if you don't want to.

2

u/L0G1C_lolilover Dec 28 '21

U can choose to not use materialstateproperty way you know

I think there was another way to style buttons like old

Its called .styleFrom property

just use the cheat sheet

3

u/Only-Split82 Dec 28 '21

I disagree to all points you mentioned. Community is big and you can find solutions to everything. But I think you just have too little experience in development in general because if you need examples to understand how something works is really low skill. The best documentation is still the code of Flutter itself. No need to google somewhere. And maybe it lacks some features but try React Native ( the biggest competitor in the field ). Almost all freatures of it are third party... And come on, you are seriously crying because a Flutter update breaks your code???

7

u/eibaan Dec 28 '21 edited Dec 28 '21

I might come from a different background. I started with GUI programming in early 1990 and for me, Flutter feels quite natural and I really enjoy that I can have a look at the complete source code. I was used to this "last century" when using Smalltalk or Java and missed that while working with UIKit (I'm more familiar with iOS than with Android which always felt inferior to me).

Because of my background, I also appreciate the "binary tree during an interview" mindset and actually believe that developers should know common algorithms and patterns and not rely on finding them somewhere. That button example is annoyingly cumbersome, I agree, but very similar in how Android does it and I couldn't come up with a better approach myself. So I accept it.

I don't feel that Flutter often breaks. Quite contrary. It's remarkable stable and as Hixie mentioned, I'm all for changing code if this will improve project. I really hated Java's approach in never ever removing deprecated methods. I prefer Apple's approach to lead and expect that developers will follow. BTW, there's dart fix which helps in migrating code and it is my understanding that the Flutter team will use this (or already use it) to make changes easy to apply.

I feel the same regarding the quality of 3rd party libraries. I'm trying hard to minimize the number of dependencies in my projects and tend to do it myself (I'm talking for my team here, I don't have to do everything on my own, I have people for that ;-) before reading through unknown code of unknown quality that might be unsupported next month.

Actually, I'd wish that the core framework (or 1st party plugins) would still expand as it did a year or two ago. I miss that warm feeling of finding new goodies every month or so. I'd really appreciate an official tree view and/or tree table widget, for example. Or native popup and pulldown menu support. Or multiple document windows. Or 3D graphics support.

I am also impatiently waiting for a solution in Dart for if let, pattern matching or destructuring assignments.

7

u/Hixie Dec 28 '21

The dart fix feature is pretty new, but yeah, we're really leaning into it now. (We don't consider something that dart fix will automatically fix to be a breaking change, for example, even if it would otherwise break the code in the flutter/tests registry -- part of running those tests is to first run dart fix on the code.)

I still find dart fix magical. :-)

1

u/eibaan Dec 28 '21

It's inspired by go fix, isn't it?

2

u/Hixie Dec 28 '21

Not sure. In practice it's just a command-line version of what we've had in the IDE plugins for a long time -- the IDEs used the Dart analyzer's logic to offer "quick fix" menu items, and dart fix just applies that at scale to your entire codebase.

3

u/eibaan Dec 28 '21

To me, the more interesting aspect of dart fix is, that any author of any package can provide a fix_data.yaml file which is then picked up by the tool and it will offer to perform AST based refactorings. Unfortunately, this feature isn't officially documented yet.

3

u/Hixie Dec 28 '21

Yeah I think the team is worried that if they document it before they are confident it's well designed, they will end up stuck with a bad language. Which would be especially ironic for the language that's intended to help with the exact problem. :-)

4

u/snrcambridge Dec 28 '21

This feels like a gripe of someone recently frustrated with some very specific changes. Flutter is excellent. The tooling is amazing, the docs are amazing, the whole premise will set the tone of the next few decades of cross os UI development. We are developers, our life is suffering at the hands of deprecation and versioning, it's the cost of being in such a dynamic and advanced field.

2

u/yes_u_suckk Dec 28 '21

I like Flutter but I agree with every single thing you said here.

Flutter has MANY problems and annoying things that make the development not fun, but I'm hopeful that it will get better eventually since it's relatively new.

3

u/AlexandrFarkas Dec 28 '21

I have been working with Flutter for 2 years now (in production). And it's an absolute joy, comparing to other tech stacks I worked with.

Probably, I just don't have these problems.

  1. Incremental breaking changes is a key to progress.

  2. I've already passed through that stage, where I needed help concerning Flutter. Now it's mostly native parts.

  3. I just write my own package (without publishing), as if I would do it in native. Native SDKs are always available, bridgings through platform channels is easy.

  4. Router is only needed if you support web (personally, I was never asked to build web, 'cause it's not much stable). Also, there is plenty of different abstractions over Router (beamer, routemaster, go_router, which are marked as Flutter Favourite).

3

u/svprdga Dec 28 '21

It's OK if you don't like it. Move on to another technology that makes you feel comfortable.

3

u/ankmahato Dec 28 '21

Let me talk about point #3

Can you quantify .. "way too much" core functionality has been left out.

Actually thats the whole point of having packages - to augment the core, and this is irrespective of the programming language or framework. I am a python ecosystem contributor and publishing a python package to pypi is no different - adding a package is super easy, zero policing of the published packages, "thousands" of packages that are not being maintained and do not work with the current version of Python. And remember Python has been there for nearly three decades now. Still every-time you use a python package you will have the same risk: "Will this package still be around in 6 months? Am I setting myself up for some serious pain down the road? All I have to go by: How recently was it updated, how many github stars does it have?"

So kindly do not question the Flutter community contributed packages in particular. The risks are same across any ecosystem.

To ensure minimal risk and quality there are programs like Flutter Favourites & Flutter Community and sites like Flutter Gems which makes sure there is some vetting of Flutter packages. So you can definitely take a look at these links.

11

u/Hixie Dec 28 '21

It's true that other package systems have similar problems, but that doesn't mean it's not a real problem. OP is totally right IMHO that figuring this out is something that makes Flutter (or Python for that matter) less fun.

3

u/ankmahato Dec 28 '21

Thank you for your comment and your contributions. Sure would be eagerly looking forward to how Flutter will solve this problem and make it more fun.

3

u/Hixie Dec 28 '21

You and me both :-P

2

u/esDotDev Dec 28 '21 edited Dec 29 '21

Such a hard problem to solve, I'm not really aware of any stacks that have this solved. Unity does the best job here, by having an active market of paid plugin developers, but it's still not perfect, and things very much still get mothballed.

I guess google could just hire like 6 engineers, who do nothing but native plugins all day, every day, year after year. That seems like the only real way to tackle it head on. Obviously very $$$ for the parent company though.

Flash had this solved for a while before it was killed off. With Adobe AIR, and a legion of paying developers, a couple of shops cranked out quality plugins for reasonable prices and sold them in droves. Looks like they are still in business, which is pretty wild: https://airnativeextensions.com/ https://www.milkmanplugins.com/air-native-extensions

1

u/ankmahato Dec 28 '21

"Alphabet, which doesn't pay a dividend at all is sitting on cash and investments of $168.5 billion. That's more than 6% of all the S&P 500's cash in the hands of a single company. And it just keeps piling up. Alphabet's cash pile is 7% higher now than it was in 2020." - Link

Actually, it makes me sad whenever any member of the Flutter team tells its users that they do not have resources to look into something. I think the problem doesn't lie with not having resources, but with the parent company not investing enough in a technology which has gained a lot of traction and has a huge potential.

3

u/Hixie Dec 28 '21

The way capitalism works is that you end up with a lot of money if what you spend your money on is what gives money back. "Invest" is a process where you put money in to get money out. The amount of money a company will invest in open source is proportional to the amount of money they will make in return.

A company might make money from open source via the good will they engender in the community (this is similar to why companies contribute to charities or pay for services in their local town).

A company might make money from open source because they benefit from the product itself in some way (e.g. Flutter saves people money by letting them be more productive than other SDKs).

A company might make money through indirect processes (e.g. when I worked on the web at Google, it was because making the web better would lead to more people using the web which would lead to more ads being shown which would mean more Google ads which means more money for Google).

Google does invest in Flutter (to the tune of dozens of engineers and other roles, and that's not even counting Dart and Skia which are other open source projects that Google funds), and that investment is proportional to the expected return. Other companies (like Microsoft and Canonical) similarly invest in Flutter, and I'm sure their investment is similarly proportional to the return they get.

But if you want companies to invest in open source more than they are currently investing, you have to show how they're going to get a return on that investment. This isn't unique to Flutter or Google, it's true of all companies and all open source. (It's why a lot of open source is funded by non-profit foundations... though they are equally limited by how much money they actually have.)

1

u/ankmahato Dec 28 '21

Very well said 🍻

1

u/alok1141 Dec 28 '21

Try Phonegap then. It's easier to work on because everything can be done using HTML, CSS and JavaScript. Disadvantages- It is very hard to design cool and responsive UI in Phonegap.

1

u/laooz Feb 05 '22

I liked Flutter but, coming from web, I missed using markup and style sheets for designing the UI.

So I developed ezFlap, a library that allows to use markup and other features inspired by Vue - in Flutter.

Check it out :) https://www.ezflap.io/

1

u/[deleted] Dec 28 '21

Bro, you should just use React. I don’t think early adoption is for you.

3

u/Hixie Dec 28 '21

I think using React is a fine choice, and would definitely encourage people to try both Flutter and React (and other solutions) and pick the best one fr their needs.

That said, I wouldn't describe Flutter as "early adoption" any more. We're well past v2. React first version came out in 2013, Flutter's first version came out in 2015 (with work in public since 2014). React's first post-0.x version was in 2016, Flutter's 1.0 was in 2018.

2

u/solohelion Dec 28 '21

This will be out of date but not too out of date: I switched from React native to flutter on a project, because every time I let my RN project sit a month untouched, when I came back, everything was broken with no code changes (I suppose I ran an update every time). And the errors with expo (which I was using) were basically “something is wrong somewhere, lol”.

0

u/supa_nagasaki Dec 27 '21

Same here I am working on a project and cannot update as it breaks the entire code base causing my team massive problems and have to keep to an older version

5

u/OldHummer24 Dec 28 '21

What kind of project is this? I have a huge project and it takes a few minutes to migrate each time

5

u/Hixie Dec 28 '21

See my other answer for more details, but in general I encourage you to use our tests registry (https://github.com/flutter/tests). We guarantee we will not break code that has been submitted there.

-4

u/Erxio Dec 28 '21

My biggest pain with flutter: I miss something like scss or sass for styling my app. A separate stylesheet where I can make changes as I wish on the basic propertiers of all widgets. I believe that there are some projects with a similar goal in mind but I would prefer a native solution here.

7

u/Hixie Dec 28 '21

Does ThemeData not work for you there? Or do you need a mechanism to classify different widgets with different "classes" like in CSS?

(If the latter, you may consider creating yourself a widget that is basically a wrapper around Theme that picks the "right" ThemeData for the section, which you would use something like:

ThemeByClass(name: 'myclass', child: ...)

...and it would just insert the Theme widget into the tree at that location based on a Map<String, ThemeData> or something.

edit: or, more efficient even, just skip the string thing and just have constants for each type of ThemeData you want, and just use Theme(data: myGreenTheme) or whatever, whenever you want to change the "class".

3

u/dancovich Dec 28 '21

Well, the main theme you pass to your MaterialApp is your style sheet.

Flutter follows the philosophy that, no matter what you are declaring (UI, stylesheet, config file) you should declare it with code, different from other languages that use XML or JSON for configuration files or style sheets. The reason is that it makes the language the source of truth, the one thing you need to learn to do anything with the framework. For Flutter that's not entirely true (you still need to know YAML for example) but compared to something like React this philosophy does hold up.

It's not a better philosophy or anything, it's just what Flutter went with. For a new framework trying to find it's space, I do understand why they don't wanna force people to learn 6 different languages to solve one issue.