getPID function

int getPID()

Returns the PID of the running flutter-pi program, -1 for all other platforms.

Implementation

int getPID() {
  if (!isFlutterPiEnv()) {
    return -1;
  }
  final dylib = DynamicLibrary.open('libc.so.6');
  var getpid =
      dylib.lookup<NativeFunction<_getpId>>('getpid').asFunction<_GetpId>();
  return getpid();
}