14

We want to develop mobile keyboard app - (Third party keyboard) that have some unique features (such translate on the keyboard).

We would like to know if there is a way to developed it once both for IOS and Android, with Flutter, or any other solution?

Pewh Gosh
  • 1,031
  • 1
  • 11
  • 29

1 Answers1

16

There's a long and a short answer to this. The short answer is basically no, it's not feasible at this time to do this.

The long answer is that it may be somewhat possible but with a fairly large amount of work for you to do. You're going to have to first create and appropriate project type in android and ios, and then import the dart code & set up the build. You may be able to start with a normal flutter application and modify the xcode/gradle builds to match the specifics for ios/android, but I'd guess that's somewhat unlikely. So you'll probably still have to maintain two separate projects, but which could import the same dart library for the UI.

Because Android and iOS use different APIs for their keyboards, you're going to need to write a Platform Plugin or at least method channels which communicate between your app and the native code, for each of iOS and Android. You'll also probably have to embed the flutter view yourself - see this example as I'd bet the normal FlutterApplication etc won't apply.

I'd guess that on android you could probably get this to work eventually with a lot of work (depending on how familiar you are with android, platform channels, and integrating libraries such as flutter's into the build); on iOS you might have luck but it's somewhat conceivable that iOS blocks certain features that flutter needs in the keyboard for performance or security reasons - just guessing from my experiences developing apps in native iOS although I haven't done a keyboard specifically.

That being said, if you do try this I'd be interested to hear the results, and if you were to go about it in a somewhat generic way that could be re-used it would be of great benefit to the flutter community!

rmtmckenzie
  • 37,718
  • 9
  • 112
  • 99
  • Hey, I need this now, can this now be done in Flutter? – hysabone.com Feb 25 '20 at 22:07
  • 2
    @BasedMusa I don't think the answer to this has changed significantly since I wrote it - flutter doesn't explicitly support making a keyboard app, but I don't see why it wouldn't be possible... just a lot of work to get going properly. I'd start with creating a simple native keyboard app on your platform of choice, then following the documentation on how to integrate a flutter view manually. – rmtmckenzie Feb 26 '20 at 15:47
  • is it possible now ? – Shoubhik Raj Mar 27 '22 at 15:27
  • @ShoubhikRaj I don't think the answer has changed significantly. It is still theoretically possible but likely quite difficult and very much unproven at this point. It would require (at least) creating a native keyboard package for each platform in Android Studio/XCode and then integrating flutter manually, then setting up channels between the native code and the flutter code to handle the various button presses and call the appropriate native methods. Impossible, probably not, advisable... also probably not due to the size + loading speed of flutter vs native. – rmtmckenzie Mar 29 '22 at 17:25
  • I don't think it is entirely impossible, because FleksySDK have developed a keyboard SDK with flutter. Their license states that they are free for personal and non-commercial use. – suzanshakya Aug 10 '23 at 12:01