Include C file in a dart/flutter project
Currently, there is no way you can do this synchronously. Sorry for breaking your heart.
With the latest stable release of the Dart SDK ( 2.5.0 as of writing of this answer ), it's possible to include a C file in your dart/flutter project.
Dart mobile, command-line, and server apps running on the Dart Native platform can use the
dart:ffi
library to call native C APIs. The ffi name stands for foreign function interface.
As of now dart:ffi
has been released as a preview feature only and the API might encounter breaking changes in the future.
You can take a look at the quick start guide here or take a look at the hello world sample on Github.
Furthermore, I need to call the C code in dart functions with return values
Refer to this example if you'd like to pass parameters and get some value in return.