I have an Ubuntu 22.04 on my PC, and also i have a snapped Linux app that created with Flutter. I have also a button for rebooting the OS in my Flutter app.
I tried two different methods:
method 1:
await Process.run("reboot", []);
message:
flutter: Running in chroot, ignoring request.
method 2:
await Process.run('sudo', ['reboot']);
message:
flutter: >>> /etc/sudoers: syntax error near line 54 <<<
sudo: parse error in /etc/sudoers near line 54
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Also this is my 'snapcarft.yaml' file content:
name: panel-gyro-compass
version: 1.0.0
summary: panel gyro compass
description: panel gyro compass
confinement: strict
base: core18
grade: stable
slots:
dbus-panel-gyro-compass: # adjust accordingly to your app name
interface: dbus
bus: session
name: org.bar.panel_gyro_compass # adjust accordingly to your app name and
apps:
panel-gyro-compass:
command: panel_gyro_compass
extensions: [flutter-master] # Where "master" defines which Flutter channel to use for the build
plugs: [network, serial-port]
slots: [dbus-panel-gyro-compass]
parts:
panel-gyro-compass:
source: .
plugin: flutter
flutter-target: lib/main.dart # The main entry-point file of the application
please show me how to run a command in Flutter for Rebooting the PC.