Flutter on desktop, a real competitor to Electron
medium.comThe road block for adoption will be Dart. Why they didn't just choose Typescript or go with native javascript is beyond me. No one uses Dart. It was probably the poorest design decision they could make.
Dart 2 is a very solid language. It's primarily an OO language but does have some functional elements in it. It's very similar to Java and C# and most dart developers think it's a better version of Java and C#. It has more features like stream, asynchronous and mixins built into the language. It's in fact a full stack language as you can write server side code in dart as well. I think Google's long-term goal is to make dart/flutter compatible with mobile (iOS and Android), web, desktop (macOS, Linux, Windows). It will be truly write once and run everywhere.
Can't agree more. Much better choice than js/ts
yea... for the 4 people that use it
Because then the Flutter team couldn't ask the language team to make extensive changes to the language when nobody had even heard of the Flutter team yet. Popular languages are popular because they already have a killer app.
You might as well ask why Brendan Eich invented JavaScript.
The project originally started with JS. It wasn't possible to make it run fast enough on iOS. iOS requires AOT, or a byte code interpreter. JS isn't very suitable for AOT, and JS byte code interpreters tend to be pretty slow too.
Also quoting one of the project founders: "FWIW what we've seen in usability studies is that people who know JavaScript can pick up Dart without even noticing. (Literally, after an hour in a usability study we'd ask people what language they'd been using and they would respond with surprise, having not even noticed that it was a new language."
> Why they didn't just choose Typescript or go with native javascript is beyond me
Whether it was a good idea or not I'll leave for you to decide, but the reason that they landed on is that the Dart VM allows for AOT compilation, which is required for iOS, while still being flexible enough to do Hot Reload.
Dart is an awesome language in my opinion. It is very easy to get into and works like a charm in combination with Flutter. Check out this article: https://hackernoon.com/why-flutter-uses-dart-dd635a054ebf !
Tangential to your point, but I'm pretty shocked that dart didn't take off more than it did. JS is an awful language, and it was even worse at the time of Dart's introduction.
Perhaps people will pick it up. I would like to think that people will eventually stop religiously sticking to JavaScript. Right now, they are forced to use it because the alternatives are more or less worse.
I would like to consider it a beginning of something better.
Then why not TypeScript, which is a more powerful language than Dart and has a much better ecosystem?
Dart has a sound type system. Why would someone voluntarily deal with TypeScript unless forced to by the browser environment?
Row polymorphism and algebraic data types if we want to talk about things Dart does not have, with an enormous ecosystem at your disposition.
If we want to prioritize a sound type system, why then go for a language that is for the most part Java but with no ecosystem, instead of something like Reason/OCaml, Haskell, PureScript which absolutely blow Dart out of the water as languages; or even if your number one priority is targeting Java devs with something more palatable, why not Kotlin even?
Why give artificial life to a language that was on its deathbed and brings absolutely nothing useful to the ecosystem yet will contribute to the amount of churn suffered in the industry?
If you talk about ecosystem as a number of community-built packages for a language then this argument is meaningless.
Just start creating packages for this language and very soon you'll have a rich ecosystem too.
This is not an inherent characteristic of a language itself, it's something powered by the community and built over time.
The larger community is => the better ecosystem we get.
Re: lacking features. Feel free to submit a request here https://github.com/dart-lang/language
Dart team is already working on some nice additions to the language. If ADTs are something many community members are looking for, I'm pretty sure it'll be added.
> and brings absolutely nothing useful
Dart is a language that's predictable (no WATs), performant, has the best built-in tooling to facilitate quick iterative development, the best package manager and can be used to build web, mobile and desktop apps with high level of shared codebase between them.
It's not the best language by any means but it's already a good language. And it's getting better and better.
Well that is a non-answer on every front. Of course, if devs start pouring effort into Dart it will get an ecosystem; but why would I want to when Dart offers nothing over other languages?
And yes, we can submit feature requests, and the language authors may and may not add them. I'd rather go for a language that further aligns with the expectations of a modern language from the start rather than plead with the authors to turn it into something it's not.
> Dart is a language that's predictable (no WATs),
Ok, so it beats the raw JS with no dev tooling development experience. That's the bare minimum.
> performant
Plenty of performant languages to go around, including many more performant ones.
> has the best built-in tooling to facilitate quick iterative development
What does it bring over any other language with a semi-decent REPL?
> the best package manager
You'll have to expand on this, it's a very bold claim.
> and can be used to build web, mobile and desktop apps with high level of shared codebase between them.
So can any compile to JS language, Kotlin, C#, Clojure, among others, and since you place so little value on ecosystem I'll throw a special mention to Idris in too, which can compile to performant JS, the JVM (no bridge necessary on Android), C (usable on iOS) and pretty much whatever; and almost guaranteed blows any other language you can name out of the water when it comes to modern features and being pragmatic.
TypeScript is in absolutely no way a "more powerful language than Dart".
It's a clutch on top of JS.
>Why they didn't just choose Typescript or go with native javascript is beyond me.
It wouldn't be native compiled code (which this says it is), and it would have a poorer language experience plus all the baggage that comes with JS.
>No one uses Dart
You'd be surprised.
As someone who has recently learnt JS and is using it, I think reducing the JS usage as much as possible is a very good thing.
I believe flutter will be the only thing that will be truly "write once, run everywhere" as it will be compatible with with mobile (iOS and Android), web, desktop (macOS, Linux, Windows).
I'm wondering why people don't write cross platform applications with Qt.
I think c++ (and qml to some extent) scares people vs. JavaScript, where you have thousands of libs for every situation to back you up
You can write it in Python is you're scared of C++. QML let's you inline JavaScript, or call it from a file.
Qt comes with 5, 000 classes for every situation to back you up, before you need to go to the community.
I think that a lot of developers are simply scared of it, without just cause. They believe rumours, without ever actually trying to use the thing. They don't evaluate first.
pyside and pyqt4 both take away a lot from the power of qt. Not worth it if you ask me.
Because most Electron apps are JS devs working around browser issues by packaging a single browser with the application.
I look forward for the Electron wave to fade away just as MSHTML and XUL waves died before it.
Only there never where any big MSHTML and XUL waves.
I surely remeber quite a few on the enterprise space and plenty of XUL based installers.
Does Qt have the same features as Flutter? I'm thinking about an excellent IDE, hot reloading, ability to target mobile and desktop etc.
* Excellent IDE
Yes. It's well-written C++. Any IDE can handle it, but the also have their own which gives you a few more things, like drag'n'drop design.
* Hot reloading
Depends.
Old-school Qt? No. It's more powerful, but can't hot reload.
New-school QML? Yes. But you are limited to QtQuick, which is only on-par with Electron's features.
* Ability to target mobile and desktop, etc.
Yes. Supported targets include: Windows, UWP, Linux, macOS, Andorid, iOS, watchOS, tvOS, QNX, and other embedded platforms.
C++ is harder to use, so developers are more expensive to hire.
QT is either GPL which is viral i.e. you have to open source your software under the same license, or quite expensive. Even if you’re working on open source GPL software, free QT edition has less features, esp. on embedded.
> QT is either GPL which is viral i.e. you have to open source your software under the same license,
it is not.
Technically, LGPL option allows using in proprietary software. Practically, static linking is often better e.g. makes executable much smaller. And even with dynamic linking, see this note from https://blog.qt.io/blog/2009/11/30/qt-making-the-right-licen...
> If you are shipping an executable, you must include any data and utility programs needed for reproducing the executable (i.e. must provide components needed to recompile with a new version of the library) unless such data and utility programs are normally distributed with the major components of the operating system on which the executable runs
For developers of proprietary software, flutter’s BSD 3 clause license is way easier to comply.
Because, unless you want to build your applications statically (which I've done), it requires a large client runtime installation?
Are there any good examples of a cross platform application written in Qt that is available on iOS, Android, Mac, and Windows?
Well, you still have a pretty large run-time with Qt. If you want something slim, you can use neither Electron nor Qt.
Because qt UI is in all ways worse than what browsers can already do. All qt does for displaying web pages is it embeds chromium, same as electron does. Trying to tie c++ to that is shooting yourself in the foot if you can just use node, which electron does.
> All qt does for displaying web pages is it embeds chromium, same as electron does.
It doesn't:
> WebView is a component for displaying web content which is implemented using native APIs on the platforms where this is available, thus it does not necessarily require including a full web browser stack as part of the application. [0]
It does. https://wiki.qt.io/QtWebEngine
Webview is unreliable and not used by electron apps for a reason, you cannot control anything about it. You're stuck with whatever native browser the system has. That's alright for basic things, but hardely what you'd sanely deploy tech that relies upon modern js.
Not sure what's meant by 'native browser.'. My last gui app used qt-webkit and webviews. It's not chromium and very controllable...
Native browser meaning the systems browser, like safari, or edge.
Because Qt is bad. Do you think after nearly a quarter of a century that its problem is that it's just like, not well-known enough?
Correlation != causation.
And even if that was the reason, your response didn't make anyone any smarter. How is it bad? Which you can't answer, because your only line of reasoning is that it has to be bad, because it's not as popular.
The UI is bad imitations of native widgets and has been forever. Always in the uncanny valley, except if you're running only KDE.
The setup of IDE/building/ etc is harder than it should be.
PyQT has mostly been the unloved stepchild, with third rate support.
Compile times with C++ are awful.
Major breaks between versions (QT4 vs 5 etc).
bad how?
Flutter isn't a competitor to electron as you can't target web browsers with it.
I tried Flutter over a year ago and found the instant reloading of code nice and has most of modern features but went back to native as the library support is still non-existent.
The real competitor to flutter is kotlin cross-platform from jetbrains. Most android developers are already familiar with kotlin, unlike dart, and also has great tooling.
I look forward to seeing which one wins mind share as they are well designed options.
Incorrect. You can target web browsers with it.
> Dart’s flexibility in compilation and execution doesn’t stop there. For example, Dart can be compiled into JavaScript so it can be executed by browsers. This allows code reuse between mobile apps and web apps. Developers have reported as high as 70% code reuse between their mobile and web apps. Dart can also be used on a server either by being compiled to native code, or by compiling to JavaScript and using it with node.js.
Source: https://hackernoon.com/why-flutter-uses-dart-dd635a054ebf
Dart can target web but Flutter doesn't yet have support for browsers.
It's not fully compatible with web yet but there is ongoing work to make it happen. Flutter itself is about to be officially released in two days and I am sure there will be more push to make it web compatible soon.
I'll have to check it out, because this seems to be what I've been waiting for: access to Android and Windows eco-systems, reasonably small .exe sizes and excellent performance.
The other things are just icing on the cake: best in class framework, hot-reloading, runs on IOS (until Apple gets irritated), development on Linux, and a more than decent language to write apps in.
Flutter for ios android web win mac sounds like the holy grail of cross platform development! Tempted to invest v significantly, one major concern though is the focus on Angular for web. IMHO Polymer would have been a much better choice, since most browsers now support web components custom elements natively, so Angular focus is a major turn-off for me.
The biggest question is will companies start migrating to Flutter from Electron.
Plus who will decide to use this in a market dominated by Electron?
[raises hand] If it can avoid a >100 MB hello world, I’m on board. That makes it worth learning a language I would never have heard otherwise.
If that's a serious suggestion then...
* Dart/Flutter {iOS, Android} [0]
* (Scheme|Lua|C)/IUP {Linux, Windows, macOS} [1]
* (QML with JS)/QtQuick {Windows, Linux, macOS, UWP, Android, iOS...} [2]
* (C++|Rust|Go|Python...)/Qt {Windows, Linux, macOS, UWP, Android, iOS...} [3]
* (TCL|Ada|Haskell|Python...)/Tk {Windows, Linux, macOS} [4]
* (TCL)/Hecl {Windows, Linux, macOS, Android} [5]
* (Scheme|C|JS|Haskell...)/GTK+ {Windows, Linux, macOS, Android^} [6]
* (C++|Python|Ruby|...)/WxWidgets {Windows, Linux, macOS, {Anywhere GTK or Qt run...}} [7]
(^ May not be stable or officially supported)
... All the platforms listed are cross-platform.
Some look native, some don't, but no Electron app does anyway.
Most package to single binary, some need proper packaging.
All are very simple to get started.
Tk has the least features, but TCL is just a shell language, so getting started is ridiculously easy. However, Tk can do things like inject its frames into any running process's window.
QT and GTK+ are the most powerful, which can confuse newcomers. But they're still simple to do simple things with.
I've used all but Flutter in a professional environment (but evaluated it), sometimes as maintainer, sometimes building something new. They're all solid. Different drawbacks with all of them, but there's always tradeoffs in programming.
For a beginner, I'd probably recommend QtQuick or WxWidgets.
[1] http://webserver2.tecgraf.puc-rio.br/iup/
[2] http://doc.qt.io/qt-5/qtquick-index.html
[3] https://wiki.qt.io/Language_Bindings
Most of them have been tried for ages and never got anywhere, and still look like crap (e.g. tcl).
Others have crappy support for different platforms (e.g. GTK and Windows/OSX) and that's for decades, not just because they are new.
None of them has the promise of Flutter: modern JS-like language, dead easy development, simple IDE support, cross platform, nice UI toolkit, hot reloading, and so on.
> modern JS-like language, dead easy development, simple IDE support, cross platform, nice UI toolkit, hot reloading, and so on.
That would be QtQuick.
Nobody cares about the "market" (in fact, there's no "market").
You ship apps, and they can be in whetever you like. No user cares if the app is in Electron or whatever (except only negatively, as Electron wastes resources).
If Flutter apps run faster and eat less resources, people will go to them, everything else being equal.
More dev currently using Electron will not matter.
Or may be Electron will improve to the point where Switching to Flutter didn't matter?
It doesn't matter which framework really, any improvement is much better then what we currently have. WhatsApp on Mac currently uses 1GB Memory sitting there doing nothing. Not too bad for an Electron App I guess since Telegram uses 650MB after being opened for 48 hours, but it does sit at 150MB once it is closed and reopened.
And before anyone else say Memory were suppose to be filled, consider that paging actually lower the lifespan of a SSD, I have currently done 2TB of writing over the past few days.
Also some developers may not like that source code in Electron apps is always accessible.
Baby steps. First have a viable alternative, then the rest may follow. :)