Difference between writing platform specific code vs dart:ffi code


What is difference between writing code using dart:ffi in flutter or writing code with the method chanel in flutter.


dart:ffi is used to call C/C++ code - typically to reuse an existing C/C++ library - often a CPU intensive operation, like codecs, image processing, cryptography. The C code has limited access to the system APIs.

Method channels are used to access the underlying environment and its APIs - so are written in Kotlin or Java on Android, Swift or Objective C on iOS and macOS and Dart in Flutter Web.

So, for example, if you want to read the battery level of the device, you need to use a method channel and implement the native API call in its native language, e.g. Java for Android. Conversely, if you want to call a C library that implements a cryptographic hash, the easiest way is to use ffi.

Check out the Flutter Week videos for a novel use of ffi to call the Android NDK / Oboe audio library.



  • actionValidateCustomerAddressFormAfter triggers the hook before Prestashop's form validation
  • Why does a Javascript function act differently upon instantiation than execution?
  • What functionalities that RxJS provide for Angular2?
  • Inserting a translation into a placeholder with Emblem.js
  • Angular 6 - rxjs pipe not working on valueChanges
  • django-rest-framework accept JSON data?
  • iOS 11 on NavigationBar pull down - height of bar changes?
  • How preserve query string and hash fragment, in React-Router 4 ?
  • Post hoc tests with ezANOVA output
  • How to extend Sequelize model
  • How to handle asynchronous error in Node.js
  • Android BottomNavigationView with Badge [closed]
  • How to install or uninstall SonarQube plug-ins with HTTP?
  • Downgrade NG2 Directive to AngularJS
  • Reveal Icon Button - Bootstrap 3
  • How do I construct a local movie URL properly?
  • how to reload page after uploading images
  • jQuery how to translate livequery to on?
  • OpenCV::solvePNP() - Assertion failed
  • CSS style for container with transparent border images
  • Xmlserializer to C# object, store original XML element
  • Access to database zend framework
  • Videos won't upload
  • Django REST framework - HyperlinkedRelatedField with additional parameter
  • Arraylist of strings into one comma separated string
  • Stop an element moving with padding on hover
  • When to use the tag in the head and body section of a html page? [duplicate]
  • How to run chrome.tabs.insertCSS from the background page on each page?
  • Neo4j…how to get a visual representation of my data?
  • Support of :after in IE7
  • Python 3x- Compression Makes File Bigger :(
  • Cloud Code: Creating a Parse.File from URL
  • Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner
  • calling IO Operations from thread in ruby c extension will cause ruby to hang
  • Write to .csv file with PHP (Commas in Data Error)