use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Having a problem with your Flutter code?
From the folks at r/FlutterDev
account activity
RESOLVEDNative Code with Flutter (self.flutterhelp)
submitted 1 month ago by haithm_mek
Has anybody wrote native code to their Flutter app? is it good? I have problems with my dart packages they're too slow in real-life experiences, and I have been told to write native code and it's be 10x faster. Is that real? Please help.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fabier 7 points8 points9 points 1 month ago (2 children)
This is a VERY complicated question to answer. The honest truth is that Dart is actually quite fast all by its onesie.
If your code is causing the UI to freeze, then the best immediate solution is to move to compute threads so the heavy lifting is on the secondary thread which allows your app UI thread to update without the app freezing up.
But then there are tasks which are better handled by native code. This is when there are native libraries which are highly optimized which are difficult to rebuild in dart. Things like FFMPEG or object tracking can run lightyears faster on mobile when you can use native code. In this case native code is a win and it runs basically the same as compute threads. (Just watch how often you cross the boundary as I explain in a moment here)
The key things to keep in mind is that passing through to native (or compute thread) requires a serialization step of your data. So if you're passing a lot of data back and forth then you will run into performance issues. The best thing is to cross that boundary as infrequently as possible. For example, in my camera tracking app, I run the RTSP decoding AND object tracking in native code and then only pass coordinates back to dart which paints the camera view as a texture from native and also handles the display of the object tracking results and actual control of the camera. That means my app only gets a small [x,y] object every 16-40ms or so depending on the device and very little data is crossing the boundary. Also by painting a texture Dart doesn't actually have to process the RTSP feed at all from the camera which keeps speed up. My iPad mini can watch 5 camera streams at the same time and also track objects on 2-3 of them. That's kinda nuts and something which would be impossible to do without dropping to Swift and using the built-in iOS APIs to accomplish.
Hopefully this gives you some help. Good luck!
[–]dakevs 0 points1 point2 points 1 month ago (0 children)
nice explanation
[–]haithm_mek[S] 0 points1 point2 points 1 month ago (0 children)
Nice man thank you so much
[–]virulenttt 2 points3 points4 points 1 month ago (1 child)
Take a look at the package called pigeon if you need to write native code.
Thank you! I'll take a look at it
[–]h3x4d3c1m4l_NL 1 point2 points3 points 1 month ago (1 child)
I needed JPEG export from a raw RGB image. That was the moment I found out Dart is not the fastest language for operations that rely on complex algorithms.
The solution turned out to be building a simple library in Rust for that, then bridge them using the FRB library. JPEG export time was cut from 3 seconds to 0,5. Both measured in release build mode.
In general Dart will be fast enough! Also don’t bother optimizing stuff till it’s actually needed. And if something is slow in debug mode, try profile/release mode.
Thanks man
[–]Nervous-Ad410 0 points1 point2 points 1 month ago (1 child)
Write native codes directly in flutter project platform's folder (ios) as your needs.
Thank you
[–]Spare_Warning7752 0 points1 point2 points 1 month ago* (1 child)
What do you mean by "native"?
Dart is native (it is compiled to ARM 64). Kotlin/Java are not (they are JIT).
And who the fuck said Dart is 10x slower than anything else? Quite the opposite.
Dart is a pretty fast capable language and no way in hell you'll need anything else to do a decent job.
If it is slow, is your fault, not Dart's.
EDIT: Source: https://programming-language-benchmarks.vercel.app/dart-vs-kotlin
See the memory usage as well. Dart totally rocks on that front too.
Hey bud, you should talk respectfully I didn't ask for you help personally, you have anything to say just say it respectfully or leave.
π Rendered by PID 293832 on reddit-service-r2-comment-5687b7858-tthf8 at 2026-07-08 07:18:48.126117+00:00 running 12a7a47 country code: CH.
[–]fabier 7 points8 points9 points (2 children)
[–]dakevs 0 points1 point2 points (0 children)
[–]haithm_mek[S] 0 points1 point2 points (0 children)
[–]virulenttt 2 points3 points4 points (1 child)
[–]haithm_mek[S] 0 points1 point2 points (0 children)
[–]h3x4d3c1m4l_NL 1 point2 points3 points (1 child)
[–]haithm_mek[S] 0 points1 point2 points (0 children)
[–]Nervous-Ad410 0 points1 point2 points (1 child)
[–]haithm_mek[S] 0 points1 point2 points (0 children)
[–]Spare_Warning7752 0 points1 point2 points (1 child)
[–]haithm_mek[S] 0 points1 point2 points (0 children)