1

Can I use dart:ffi to call C APIs on flutter desktop. What happens to the performance after that ? Can we use C to speed up flutter?

Thanks

nvrthles
  • 99
  • 1
  • 1
  • 6
  • What do you mean "what happens to performance after that"? Why do you expect using FFI to change future performance? – smorgan Nov 17 '20 at 02:33
  • @smorgan not exactly. But sometimes calling code from another language introduces a bottleneck at least according to what I read here (https://stackoverflow.com/questions/8628326/what-is-the-difference-between-a-wrapper-a-binding-and-a-port) But like in the python community whenever there is desperate for a speed up it gets written in C. I just want to know if you could do something like that. – nvrthles Nov 17 '20 at 02:42
  • 1
    Dart code in a Flutter app is compiled to native code; AFAIK there's no native compilation for Python. Whether C is faster than Dart compiled to native code for your specific use case, who knows. You'd have to profile and see. – smorgan Nov 17 '20 at 04:11

1 Answers1

1

Can I use dart:ffi to call C APIs on flutter desktop.

Yes. FFI works on all desktop platforms. It's used to implement some of the desktop implementations of some of the flutter.dev plugins, in fact.

smorgan
  • 20,228
  • 3
  • 47
  • 55