Hi guys, can Kotlin Multiplatform support Flutter?...
# multiplatform
c
Hi guys, can Kotlin Multiplatform support Flutter? Just wondering if it's possible to use KMP to write a library for sharing the data layer for Flutter apps.
j
You can export a C API and consume it like any other native library from Flutter. Won't be easy, and you obviously lose a ton of language features. It will be a pain for anything but a massive, pre-existing app where the overhead of a such a setup could possibly begin to pay itself off.
m
I have not used but there is https://pub.dev/packages/klutter In general I wouldn't choose to write a data layer for flutter apps in Kotlin instead of Dart. On the other hand I have a large and complicated KMP library that has one consumer of the prior non KMP version that is using Flutter. I had suggested to them to write their own facade KMP layer on top of it that exposes simple functions that a Flutter plugin could use. Versus writing a complicated plugin in both Swift and Kotlin.
c
@jw Thanks for the suggestion. Given my skillset and the potential use case I think it's unlikely to happen. I don't really think I could be a guy to turn a light switch to be composable friendly. It was a good talk and sharing though. @Michael Krussel Thanks for finding this repo for me and your insights. Sounds like it's easier to rewrite the project in KMP when I have the chance. I am just thinking ahead as there's a role that I am applying for, they have 2 Flutter projects , and the hiring manager is also interested in KMP (so am I). Hence, I am thinking if I can get the job, how I can gradually introduce KMP to the team.
m
Yeah, using KMP in the flutter app as a starting point for transition away for flutter could be useful, but the transition period will be painful. Access the KMP will be through Flutter's plugin system which doesn't seem all the easy to use. Especially for something that would be access as often as a data layer. I've not actually used Flutter, so that is mostly an uninformed opinion.
👍 1