flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.69k stars 27.61k forks source link

Add support Vala for linux #110410

Open listepo opened 2 years ago

listepo commented 2 years ago

It would be very nice to be able to create apps and plugins for linux with Vala. C/C++ is very good, but the entry threshold is very high.

stuartmorgan commented 2 years ago

/cc @robert-ancell for input (IIRC we discussed this briefly during the initial bringup?), and @cbracken.

There are a few elements of support we could consider if we wanted to do this:

Some important considerations here:

robert-ancell commented 2 years ago

My first question would be what sort of apps and plugins did you have in mind? This is only going to be useful if a significant part of the application or plugins is to be written in native code as opposed to Dart/Flutter. In my experience I've almost never used plugins with Flutter preferring to use Dart and falling back to Dart+FFI if it that isn't possible.

Changing the application from C to Vala should be do-able right now, this just requires rewriting the template in Vala as all the exposed Flutter APIs should be wrappable with a .vapi. This could be done with a separate github project that is then copied into projects that want to use it. This could be assessed for popularity to decide if this would warrant becoming an official template option in Flutter.

Writing plugins in Vala should also be do-able if they are pre-compiled to C for distribution. Again, if significant plugins made use of this then the next step would be to consider if Flutter should natively support valac and remove the pre-compile stage.

robert-ancell commented 2 years ago

I have used a lot of Vala in the past and it's a language I do love - much better than fighting C. Dart reminds me a lot of Vala particularly in writing a lot of asynchronous code.

stuartmorgan commented 2 years ago

Writing plugins in Vala should also be do-able if they are pre-compiled to C for distribution.

Interesting, so it's straightforward to do just the transpiling step and stop with the C output?

If someone in the community wants to write up a step-by-step guide to writing a plugin that way and then link to it from here, that would be a good starting point to gauge interest.

robert-ancell commented 2 years ago

Interesting, so it's straightforward to do just the transpiling step and stop with the C output?

Yes, valac --ccode will just spit out a .c file for the .vala input and can be compiled just like any other C code.

flutter-triage-bot[bot] commented 5 months ago

The triaged-desktop label is irrelevant if there is no team-desktop label or fyi-desktop label.