News for hackers. Stuff that matters.
Re:Flutter for Linux by blandflakes on Wednesday July 08, 2020 @02:46PM (#23772997)
Dart actually has a lot of characteristics that make it appealing for a lot of the areas I'd have (begrudgingly) used Go - command-line tools or local utilities. It "can" be scripted, but also AOT compiles, has a saneish type system with generics, and doesn't have pointers to deal with. It's hard for me to want to use it on the web, but I keep watching it and wishing good things for it.
Re:Flutter for Linux by wstrange on Wednesday July 08, 2020 @03:27PM (#23773374)
Dart produces surprisingly small docker images for server code. I recently created small Cloud Run web service with Dart - the docker image is 5.2MB compressed, 12.9 MB as reported by docker.

I'm not even sure Go would do better on image size. Tree shaking does wonders here.

Re:Flutter for Linux by vetinari on Wednesday July 08, 2020 @03:00PM (#23773135)
> command-line tools or local utilities.

FFI is quite a PITA, though. Soomer or later you will have to interface some platform libraries, and Dart doesn't make that easy.

Re:Flutter for Linux by timsneath on Wednesday July 08, 2020 @03:21PM (#23773310)
Curious what platforms you're interested in integrating with. We're experimenting here and looking for feedback. As a fun demonstration of the effectiveness of FFI, you can now build Petzold-style native Windows code with Dart: https://github.com/timsneath/win32/blob/master/example/hello...

And here's a 500-line version of the Kilo console text editor built with Dart: https://github.com/timsneath/dart_console/blob/master/exampl...

Unlike the original, it runs on both Windows and UNIX-based operating systems.

Re:Flutter for Linux by vetinari on Wednesday July 08, 2020 @03:59PM (#23773643)
I'm actually more interested in Linux side of things. That doesn't prevent me from looking how things are done on Windows, of course.

To be fair, last time I looked into dart, the idea of FFI was ports, which was too overcomplicated and undercapable, if you needed something like Gtk or Vulkan. Looking into it now, I see the dart:ffi package is shaping up nicely, so I will have another look at dart again.

Re:Flutter for Linux by malkia on Wednesday July 08, 2020 @06:49PM (#23775072)
Tim, it should be possible that the main .exe (or binary on linux/osx) to export functions, and they can be found back through the flutter_engine.dll/.so, right? (At least on windows it's possible for the exe to __declspec(dllexport) things, not sure on Linux).

But even if not, if there is a way to (given might be slow and tedious) to compile what would've been flutter_engine.dll statically linked to your main (host) app, and maybe somewhat hinting here is how to find the "GetProcAddr/dlsym/etc." functions - if one is to look for them.

Further on, the generated from dart .so file can be embded (as resource? or slapped at the end of the binary/.exe?) + slapping all other resource - resulting in single app :)

I know it's possible, just not so easy to support it (I guess). It's similar to have java/python can be packed into one executable with all C/C++ ffi functions they call (at cost of some build time and effort to achieve so).

Then you'll have killer platform for video conferencing (zoom, bluejeans, etc.), messaging (slack, etc.) - and just single binary to deploy.

(Oh, on top of that slap a web server into it, and make it that if called with specific command-line option, now it acts as web-server, and the app is visible through the web).

Re:Flutter for Linux by jamil7 on Wednesday July 08, 2020 @03:05PM (#23773176)
> FFI is quite a PITA

This is what made me nope out of it last time I experimented with a Flutter module in my app. I'm still watching it closely though as it could be a great fit for other projects.

Re:Flutter for Linux by kjksf on Wednesday July 08, 2020 @04:33PM (#23773932)
This might be outdated opinion (hard to tell without OP explaining what he finds "a PITA").

dart:ffi (https://dart.dev/guides/libraries/c-interop) is a recent addition to Dart and from where I stand it's a decent FFI system.

Maybe not as good as PInvoke in C# or ffi in luajit but better than, say, jni in Java (and any other FFI system that requires you to write glue code in C i.e. python, ruby, nodejs).

Re:Flutter for Linux by malkia on Thursday July 09, 2020 @01:26AM (#23777185)
good thing to have in an FFI system is ability from one language to call another from callback, and back and forth (if it need to). I believe Dart allows for that. That to be said, stack walking is going to be painful to decode (probably), best I've seen is C#/C++ on Windows - where it flows naturally from one to another.
Re:Flutter for Linux by jamil7 on Thursday July 09, 2020 @03:58AM (#23777952)
Thanks good to know, my experience was most likely outdated as well.