cheasonxie
cheasonxie

Reputation: 101

How to get current pid of current process in dart?

I need to get the pid of current processs on flutter, but I cann't find any static method in Process.dart, how to get it?

Upvotes: 10

Views: 2313

Answers (1)

Subfuzion
Subfuzion

Reputation: 1929

Import dart:io and use the pid property.

import 'dart:io';
...
print('pid: $pid');

https://api.dart.dev/stable/2.13.4/dart-io/Process/pid.html
https://api.flutter.dev/flutter/dart-io/pid.html

Upvotes: 7

Related Questions