lookupFunction<T extends Function, F extends Function> method Null safety

F lookupFunction<T extends Function, F extends Function>(
  1. String symbolName,
  2. {bool isLeaf = false}
)

Looks up a native function and returns it as a Dart function.

T is the C function signature, and F is the Dart function signature. For example:

int32_t add(int32_t a, int32_t b) {
  return a + b;
}
DynamicLibrary dylib;
final add = dylib.lookupFunction<Int32 Function(Int32, Int32),
                                 int Function(int, int)>('add');

Implementation

external F lookupFunction<T extends Function, F extends Function>(
    String symbolName,
    {bool isLeaf: false});