Kotlin native uses LLVM. Flutter uses LLVM. Will i...
# kotlin-native
t
Kotlin native uses LLVM. Flutter uses LLVM. Will it be possible to use Kotlin in Flutter? 😬
n
Don't think that it is very likely Kotlin can be used with Flutter. After all Flutter provides a Dart API, and Kotlin doesn't support interop with Dart code.
If you are wanting to cover multiple platforms and be able to easily provide a good/consistent UX then the multi-platform approach (Kotlin 1.2 supports this) needs to be taken. Flutter uses the cross-platform approach which has fallen out of favour in recent years.
JS also uses the cross-platform approach and has failed to gain significant traction in full stack projects for instance. Often full stack projects will require a deep level of platform integration at the native level, which is seamless (mainly written using the same programming language across all platforms) and has seamless communication between platforms. Also a good/consistent UX is expected/required. In these situations the multi-platform approach is a MUCH better fit than going cross-platform.
a
I'd disagree and say react native has actually grown significantly and will continue to. It has one thing that kotlin multiplatform doesn't. Libraries and it's already out and ready.
n
Interop is much more important than providing an ecosystem.
a
Not necessarily over simplicity. Currently kotlin interop and tooling for multiplatform is very subpar
n
Keep in mind Kotlin's multi-platform system is under heavy development (currently work in progress). If things go to plan with the Kotlin 1.2 release then it is highly likely the multi-platform system will be included, as a stable system even though it will be marked experimental (becoming a confusing Kotlin tradition 😕), which happened with Coroutines but ended up being production ready anyway.
t
they said it many times at kotlinconf. experimental is production ready but with the buffer that they can change it in a breaking way should the need arise. with good documentation and tooling for the required migration if such changes are needed so that even in the worst case it still isn't that bad
I do the same thing with my gradle plugins. push them out as 0.X.X so that I can use them in production for 6-8 months before stamping it with a major
n
What is most important is that they get the general approach right with the multi-platform system. Only one chance to get it right otherwise it ends up like the situation with Java generics 🙁.
Usually when one encounters sw < v1.0 it is seen as unstable.
s
@Thiago Flutter doesn't use LLVM. Flutter engine does (it is written in C++), but it is only wrapper around skia, and text rendering from chrome. All other rendering, painting and layouting code written in Dart, which is not LLVM. Dart has its own VM and AOT compiler.
👍 1
@napperley I think in some cases writing universal cross platform UI code is more useful then writing UI for every platform.
n
Only if UX isn't important for a sw project.
m
Hopefully K/N will get the best from both - cross-platform when possible and multi-platform when needed
3
s
So it would be possible to provide kotlin bindings to flutter, it'd just be some work. I've discussed this with one of the flutter lead devs. The Dart VM has a native API, and it would be possible to write a library that wrapped certain flutter APIs, and exposed them through Kotlin. Currently the Dart VM native API is not publicly exposed, so you'd have to recompile the VM, and package it yourself. I'm not necessarily recommending this approach, but I have thought about it a lot, and it's definitely possible.
👍 2