Use a compiled dart executable as DynamicLibrary in Flutter


Since a longer time now it is possible to open a DynamicLibrary (dylib, dll, so) in Flutter. Those libraries are written in C or C++.

I’ve now tried to build a basic dart command line application, compiled it using dart compile exe and tried to load it in my Flutter application using, as you would do with the native libraries in C/C++.

typedef HelloWorldFunc = Void Function();
typedef HelloWorld = void Function();


final dynLib ='/path/to/cli.exe');
final HelloWorld func = dynLib.lookup<NativeFunction<HelloWorldFunc>>('hello_world').asFunction();

(I’ve followed this tutorial and just added an empty void function called hello_world

But the symbol could not be found:

Failed to lookup symbol 'hello_world': dlsym(0x7fec2310e5a0, hello_world): symbol not found


Is it generally possible to open dart-compiled libraries in Flutter, like DLLs written in C++? Since dart compile exe generates native machine code as well

If yes, how?



Dart cannot create shared libraries like other languages can do because it needs to be run in an embedder/DartVM.

This issue has a good explanation:


Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *