withPrivilegesAsync method
identical to withPrivileges except action
is async.
Implementation
Future<void> withPrivilegesAsync(RunPrivilegedAsync action,
{bool allowUnprivileged = false}) async {
if (!allowUnprivileged && !Shell.current.isPrivilegedUser) {
throw ShellException(
'You can only use withPrivileges when running as a privileged user.',
);
}
await action();
}