Is possible in the future kotlin has interop with ...
# kotlin-native
s
Is possible in the future kotlin has interop with Dart to work with Flutter for Fuchsia target?
🤔 3
😎 5
📳 2
🎯 7
no red 4
g
Asked already many times. No current plans about support of Dart VM
j
That is still very much a side project at Google... good strategy by JB to stay focused on the most relevant or open platforms.
3
n
sadly, because they look good together. kotlin-multiplatform share IO and Busines logic between platforms, while Flutter is good in UI for both ios and android.
j
Flutter+Dart already includes a runtime and VM for executing code across platforms. Not sure why kotlin would be of added value if Flutter+Dart solves both business logic and UI portability. That's assuming if you want your app to not use native UI and have a Material Design theme.
b
@J-Rojas I think I don’t understand why what you say excludes Kotlin from targeting that VM just like it targets the JVM
j
Nothing precludes Kotlin from working with Dart, as long as it has a stable ABI. I'm just questioning the merit of supporting Dart anytime soon since its objectives overlap heavily with Kotlin. Both target various native platforms, both have some interop features with those platforms and Flutter offers a cross-platform UI toolkit. So I'm not sure how large the niche of users would be that would need both Kotlin and Dart+Flutter together. Kotlin should focus on improved interoperability with native platforms and just get out of the developer's way... let them pick and choose native libraries and make it very easy to work with them in a powerfully typed and modern language.
5
g
Would be better to put effort of community and (probably) Kotlin Team on Kotlin/Native idiomatic UI framework or multi-platform UI framework for Android/iOS using platform UI components or even something more custom (like Yoga from Facebook) but still native for platform
👍 3
j
Agreed... keep it native all the way. When the native platforms out-pace the UI framework API (some new gesture feature on iOS for example), then you can always go back to platform specific extensions with good interop capabilities without losing the extra features on that platform.
n
Yes, you are right. Dart offers UI toolkit for mobiles(Flutter), web toolkit for frontend and ability to share Business logic and io between all platforms. But after kotlin Dart language is so ugly. Flutter is good, Dart for UI is ok, but for business logic I don't want to use it. So I want to write io, busines logic in kotlin. Common module for all platforms, full kotlin backend in ktor, kotlin js react for web, kotlin jvm for android and kotlin native for ios. Both for mobile UI - Flutter is good. So kotlin and Flutter can be good together.
1
❤️ 2
🤔 1
Maybe we need ability to C interop from flutter, and kotlin native after can work with it, right?
j
Interesting point about Kotlin being a nicer language. If you'd want smooth interop between Flutter UI and a kotlin module, then the module would need to be compiled to Dart bytecode for it to be used in that ecosystem (build tools, ide, etc). It would not be a K/N project but analogous to Kotlin JVM (Kotlin DVM?) I don't think there's interop with K/N because Flutter would need to expose C header files, which I don't believe exist, and assumes a stable ABI.
n
Flutter in release mode compiled to native ARM code, so why it can't expose C headers? Generally, it's a question for dart/flutter team...
j
you'd have to look at their UI code. You can see here... the flutter packages use Dart and don't have headers. https://github.com/flutter/flutter/tree/master/packages/flutter/lib They do use C/C++ libraries for the UI rendering (Skia) so that could be natively integrated, but that doesn't seem helpful as you want to access the toolkit stack.
This is assuming you want to call Flutter from Kotlin, but that might not be the case. If you only want to call Kotlin from flutter, then maybe you can use the native interop flutter uses to call a Kotlin native library. Some data type bridging would be necessary via serialization or eventual toll free bridging like with ObjC. But ObjC support is still a WIP so let's let JB focus on that first and then we'll see where else it can go 🙂
❤️ 1
n
Sure ) Thanks for your answers!