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?
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:
-
“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. -
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). -
“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.
Appreciate it, thanks for your post.
You can make a Kotlin to Dart transpiler
To set the record straight here Dart is compiled to native. See Why Flutter Uses Dart | HackerNoon
Did not know that. My answer was based on a short research using google and wikipedia (the most reliable source ever ) Still I think most of my points still stand true.
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.
And you are correct that Dart can be compiled to Javascript, but in the case of Flutter it is compiled to native.
2-3 years ago Kotlin was not released.
I know, but the point is they probably went with Dart because Kotlin was not realeased and not famous back when they started creating Flutter (2015 or earlier).
It would be cool of Kotlin embraced and extended Flutter but i bet it would be hard to get the Developer eXperience as smooth as they’ve got it with the dart tooling (hot reload). Gradle, for instance, is a mystery and barrier to entry for many devs and that’s just the first obstacle.
I am not sure, I understood about flutter tooling. Gradle has its magic, but it is simpler than all other build systems I now (with the same functionality I mean). It supports hot reload and it works fine for web and desktop applications, so all one needs is a good plugin.
True everything is possible with Gradle, but it seems like it would take a lot of work to get the DX that Flutter offers today. Check out this video. Flutter For Beginners - Episode 1 Introduction - YouTube
I’m a huge Kotlin fan, been using it since beta, went to Kotlinconf last year, and hope to get in this year, but it’s looking like Dart offers the easiest client-side solution at the moment. You can share code between web and cross-platform mobile apps. And it’s all documented and there are tutorials and courses. Seems like the full package.
Flutter may be the best choice when making a mobile app for both Android and iOS although it may fall victim to the way people prefer to do things. ASP.NET is much better than PHP but they’re still losing by a lot. PHP being free is not really the reason either.
Performance is important especially for mobile apps and similarly C++ for video games.
Could anybody explain what is the meaning of native? I heard that Kotlin compiles to js. I believe you are referring to Kotlin.js. From frontend development, I hear that js is compiling to native via webpack, which should make it faster. Please note that I hear these things… I am not an expert and I would like to understand this a bit better. Adding to my confusion, ppl talk about hybrid apps… how do they relate to PWA and native? I need to understand these concepts better so I can fully understand this post. Thank you to @Wasabi375 for offering this great answer btw.
Technologies that I heard before: Android Java, Kotlin, Flutter, Xamarine, PhoneGap, PWA(React, Angular(?)) and of course, there is something call Fuchsia. I only use the first one, learning the second one…
Kf
Kotlin as a language currently compiles to 3 different “targets”. The first and also “normal” one is the jvm or Java Virtual Machine. This is a kind of machine code that can be run on any computer/device which has the jvm installed. Apart from Java (which is obvious) there are many other languages compiling to jvm byte code like scala or clojure.
The next target for kotlin is java script (js) which is a programming language mainly used in websites. While kotlin normally generates byte code kotlin js generates a java script file which you can then use in your websites.
The last and (afaik) the newest target is kotlin native. In that case kotlin still generates byte code but no longer for the jvm but for a device directly. So it can generate byte code for windows or linux, etc. This has a few advantages and disadvantages. For one you no longer can access any of the many thousands of java libraries, but on the other hand you don’t need the big jvm installed which can be advantageous on small lite devices (IOT).
In general native always means that a language is compiled to bytecode for the device directly.
I don’t know much about webdev so I can’t explain this.
As far as I know hybrid apps are apps written in js and css and then wrapped in a small app to display the program. Basically the app is written as if it where a website (js + css) and the small program around it is a web browser to display it. That way it is really easy to write apps both for android and ios. The js part can be reused and you just have to write the browser, which for android and ios exists already. You just reuse Safari/Chrome.
PWA is mostly the same but I think you skip your own wrapper program and just run in the os browser.
If there were a way to extract Kotlin types from the flutter dart libraries it might be possible to write flutter apps with Kotlin/Native
In terms of mobile development it has been used to mean many things and is almost marketing speak.
There are 2 aspects of being native, the language used for coding and what widgets are used. More native programming languages can mean faster running. Using the native widgets for a platform can mean that the UI is consistent with the look and feel of the platform.
One way to use it is that you are writing apps using the normal language for that platform (Java for Android and Swift/Objective-C on iOS) and using the widgets provided by the platform. But in actuality Java is not native on Android in the sense that it is a VM and the code is converted to actual processor instructions at run time or can actually be ahead of time.
The early cross platform approaches which were generally labelled as non-native used a non-native programming language (JavaScript or an early one I played with was in Ruby) and used HTML for the UI. These were usually slow and the look and feel often stands out as not matching the platform. This was OK for some basic apps.
Then there is React Native which is programmed in JavaScript with is not a native language and is interpreted on the platforms. However it does use the platform’s native widgets so it is an improvement. The Javascript itself is not that slow but crossing the barrier from Javascript to the native widgets was slow.
Flutter is the reverse. It uses Dart which compiles down to the native processor’s instruction set at build time so it is very fast, but it uses its own UI widgets which are fast and pretty darn faithful to the platform UI.
Any update or plan for kontlin with flutter? It will be great if there is a plan to remove DART. I dislike DART.
Unless Google commits to supporting Kotlin or JVM for flutter, I have my doubts. Also, nobody in this forum is likely to be able to answer this question.