loadLibrary static method

DynamicLibrary loadLibrary({
  1. String? dir,
  2. String? file,
})

Implementation

static DynamicLibrary loadLibrary({String? dir, String? file}) {
  if (file == null) {
    if (Platform.isIOS) {
      // On iOS the library may be linked statically into the app binary,
      // so try to resolve symbols from the current process first.
      final process = DynamicLibrary.process();
      if (process.providesSymbol('td_create_client_id')) {
        return process;
      }
      file = 'libtdjson.dylib';
    } else if (Platform.isMacOS) {
      file = 'libtdjson.dylib';
    } else if (Platform.isWindows) {
      file = 'tdjson.dll';
    } else {
      file = 'libtdjson.so';
    }
  }
  if (dir == null) {
    return DynamicLibrary.open(file);
  }
  return DynamicLibrary.open(path.join(dir, file));
}