# userId

### userId

A value representing the logged in user.

On Windows this is the user SID on all other platforms it is the value returned by `id`.

Be aware that if you are running under `sudo` then you `id` will change to 0.

If you require additional information look at the [posix](https://pub.dev/packages/posix) package or the [DCli](https://pub.dev/packages/dcli) `isPrivilegedUser` function.

Possible values:

* Windows - S-1-5-21
* All others - 1000
* if running under sudo - 0

### Example:

```dart
import "package:system_info2/system_info2.dart";

print("User ID          : ${SysInfo.userId}");
```

{% hint style="info" %}
Please help expand the list of examples by raising an issue with examples on the [onpub.dev github site](https://github.com/onepub-dev/system_info).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sysinfo.onepub.dev/reference/sysinfo/userid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
