6 ms·
Writing plugins/bindings for native code in flutter doesn't look fun. Almost 100 lines of code to write binding for function that doesn't take any parameters an
by pzo 8y ago
Writing plugins/bindings for native code in flutter doesn't look fun. Almost 100 lines of code to write binding for function that doesn't take any parameters and returns simple 'int' (int getBatteryLevel()). This just looks even worse than JNI to me. Don't want to even thing how long time it would take me to write bindings for function that do image processing.
https://github.com/flutter/flutter/blob/master/examples/platform_channel/lib/main.dart https://github.com/flutter/flutter/blob/master/examples/plat...
Which is sad because I would really want to have some fast and easy access to useful c++ libraries without wasting lots of time writing and maintaining tons of bindings for Java, ObjC, C.
We are on the verge of VR and AR and I don't see how flutter can help e.g. processing >100fps Video Feed using OpenCV library. The demo they presented on stage with ML and smile detection had quite big latency. I wouldn't call it real time.
So far it seems the easiest way to call c++ functions is using ObjC++ or Qt framework.
- sebe 8y agoThey have started a "Dart FFI project" https://gist.github.com/mraleph/2582b57737711da40262fad71215d62e https://gist.github.com/mraleph/2582b57737711da40262fad71215...
- izacus 8y ago> We are on the verge of VR and AR and I don't see how flutter can help e.g. processing >100fps Video Feed using OpenCV library. The demo they presented on stage with ML and smile detection had quite big latency. I wouldn't call it real time. I can't find any claim from Flutter team that 100fps video processing is even their goal. So that's a strange metric to measure it by - especially since it's competing against Javascript interpreted code which is far from fast by any metric. > So far it seems the easiest way to call c++ functions is using ObjC++ or Qt framework. On mobile? Qt really isn't pleasant or usable on mobile.
- rapsey 8y ago> On mobile? Qt really isn't pleasant or usable on mobile. What's wrong with it?
- dagmx 8y agoQtWidgets aren't really geared for mobile. QML however is fine
- pzo 8y agoI have recently gave a look at Qt after 5 years and it seems lots of things have changed for the better. You get the same hot reload like flutter when modifying GUI using QML (with V-Play you can even hot reload not just on simulator/emulator but on real device). Qt material theme has good look and feel. Sadly iOS theme is a little bit lacking. C++ is probably not the most productive language to write business logic but on the bright side Qt Company recently started supporting Qt for python (Pyside2) - sadly not on mobile devices for now. However it seems you can use PyQT5 on mobiles nowadays. This would be the best of all worlds IMO: 3 highly popular languages with rich libraries, tools and ecosystem -> C++ for speed critical code, Javascript/QML for UI and layout, Python for business logic and as a glue. Qt also gives me more confidence that is not going away anytime soon. It survived many years and acquisitions (Trolltech, Nokia, Digia) and have some big clients/users in automobile and open source (KDE). I will closely follow Flutter thought as well as React Native. The latter one also it seems noticed what a pain is writing all those bridges and looks like they are working on it to fix it with new architecture.
- rsp1984 8y ago> On mobile? Qt really isn't pleasant or usable on mobile. Can't confirm. We've been using QML (part of Qt) and C++ to write cross-platforms applications (Android, Windows, Mac) for many years now without any major hiccups.
- smy20011 8y agoI think you mixed UI code with platform channel code. The only code that use platform channel is this line. https://github.com/flutter/flutter/blob/master/examples/platform_channel/lib/main.dart#L27 https://github.com/flutter/flutter/blob/master/examples/plat... I really hope flutter can provide a guide for FFI though.
- thosakwe 8y agoIt seems the like the newer Dart FFI effort will benefit current users of the Dart C API, which is great news... Dart C/C++ interop hasn't been a super-bright spot so far, and I am _beyond_ glad to see it's about to change.
- deleted 8y ago[deleted]
- JustSomeNobody 8y ago> We are on the verge of VR and AR and I don't see how flutter can help e.g. processing >100fps Video Feed using OpenCV library. Use the right tool for the job. Always. If Flutter can't handle it, it's not the right tool for the job.
- sdinsn 8y agoNo, the relevant code for the function is ~10 lines The rest is UI and application boilerplate
- rockwotj 8y agoSome boilerplate to write a custom native plugin is better to me than the dependancy hell you get on ReactNative. That being said - my personal usecase would like a direct C++ interop, and flutter is working on it. See https://github.com/flutter/flutter/issues/7053 https://github.com/flutter/flutter/issues/7053 Since flutter runs as native ARM they can directly call C++ instead of having an expensive JNI bridge on android. If you're wanting something fast with native processing - flutter will be the best option out there IMO if that issue is resolved.
- Abishek_Muthian 8y agoHow is the UI/UX differences between android/iOS apps handled with flutter? e.g. iOS HID requires navigation buttons for obvious reasons & not so for android.
- adamtait 8y agoI came to the same conclusion (and I'm not a big company that can afford Qt), so I built my own. Before Flutter got a new team @ Google ~3 years back, it was a set of tools for building cross-platform apps with C++ shared libs. A few years ago, this is what many of the FAANG companies were doing with their apps. Then, React Native was released and (I guess) the management at Google decided to take a different tack. I did some research and found that Dropbox open sourced their internal tool for building cross-platform mobile apps in C++. Djinni (https://github.com/dropbox/djinni https://github.com/dropbox/djinni) uses an interface definition language to generate bindings between C++ & ObjC & Java (via JNI). From this, I added some tooling to help get the build setup and define some basic UI elements while trying to keep it simple. If you happen to give it a try, I'd love to hear your thoughts: https://github.com/adamtait/ctheworld https://github.com/adamtait/ctheworld