sendNative method

Future<void> sendNative(
  1. String title,
  2. String body
)

Sends a native OS notification.

On macOS uses osascript, on Linux uses notify-send. Falls back silently on unsupported platforms.

Implementation

Future<void> sendNative(String title, String body) async {
  try {
    if (Platform.isMacOS) {
      await Process.run('osascript', [
        '-e',
        'display notification "$body" with title "$title"',
      ]);
    } else if (Platform.isLinux) {
      await Process.run('notify-send', [title, body]);
    }
    // Windows and others: no-op for now.
  } catch (_) {
    // Best effort.
  }
}