Kotlin Language Feature Request: support Flutter


#1

Kotlin/Native is a great but limited to Objective-C & not Swift interoperability, but Flutter is an open source Framework that currently only uses Dart (which isn’t as useful as Kotlin)
can somebody extend Kotlin functionality to the Flutter framework?


Kotlin & Flutter
#2

First I don’t think you will get any more answers by posting the same topic twice and it will definitely not make people want to help you more.
The reason (I guess) why people probably did not answer you the first time when you asked for tips on how to extend Kotlin native to work with flutter is that the it looked like you have put no effort into the question yourself in the first place. Programming languages are a massive complex system so are frameworks like dart. To help you with that question you would need someone who both knows dart, flutter and understands how kotlin native works internally (not just how to use it).

So as I do neither of those 3 I did some digging. Firstly as far as I can tell dart does not even compile to native but is either compiled to js or running on a vm (just like Kotlin if you ignore native). That means kotlin native is the wrong approach anyways as you can’t interface with Flutter which as far as I can tell is written in dart itself.

So to answer your questions:

  1. “Can someone extend Kotlin to work with the flutter framework?”
    Maybe. It depends on how flutter works to create apps. If it compiles down to native code or runs on a vm on the native device, Kotlin can probably not interface with it. It might be possible to create the right tools to interface but in that case you could just as easily port flutter to Kotlin or create your own framework. If it compiles to javascript and runs in a browser on the device it might be possible to create the required interfaces to combine them.

  2. Will someone extend Kotlin or Flutter to interface with each other
    I personally doubt it. Flutter was build and designed with a different language in mind and as I explained above, combining them might be more work than just creating a new framework for Kotlin.
    Also I don’t think there is a need for it. Kotlin can already build for android and has therefor full access to all frameworks for building apps on android.
    Hybrid app development should already be possible by using javascript and frameworks to run mobile pages as apps ( I don’t have any experience here so I can’t comment how viable those options are). Also Kotlin native will probably at one point fill that gap as well. But Native is still in early development so there are no frameworks for it yet (as far as I know).

  3. “Any tips for you on how to do it yourself?”
    Look into how flutter works internally and see if you can find a way there. Also don’t just post a 3 line issue on their github. If you really want this you will need to put in a lot of the effort yourself or at least proof to them that there is a real demand for flutter to work using Kotlin (which I am not sure of). But definitely put in some research first and don’t repost (Normally I would have just flagged this as spam and I don’t know why I didn’t)


If you just want to build a small app I would suggest you decide on either android or ios as it will make life much easier for you (especially if you want to use Kotlin). If you really need both and have to use kotlin I guess you might want to look into other frameworks ( I don’t know if there are any and native is as I said still in early dev) or use dart with flutter. You might also want to look into frameworks using Js to create apps as kotlin does compile to Js as well.


#3

Appreciate it, thanks for your post.


#4

You can make a Kotlin to Dart transpiler


#5

To set the record straight here Dart is compiled to native. See https://hackernoon.com/why-flutter-uses-dart-dd635a054ebf


#6

Did not know that. My answer was based on a short research using google and wikipedia (the most reliable source ever :wink: ) Still I think most of my points still stand true.


#7

I wasn’t expressing an opinion on the other points, just correcting the info on Dart and linking to the article of why they chose Dart.

I had a similar reaction to the OP wishing that Google went with Kotlin instead of some unknown language Dart, but I know it as not as easy as the OP thinks it is.


#8

And you are correct that Dart can be compiled to Javascript, but in the case of Flutter it is compiled to native.