showNativeNotification method
Show a native OS notification.
Implementation
@override
Future<void> showNativeNotification(
String title,
String body, {
String? icon,
bool sound = false,
}) async {
if (_platform == NativePlatform.macos) {
final soundPart = sound ? ' sound name "default"' : '';
final script =
'display notification "$body" with title "$title"$soundPart';
await _runSimple('osascript', ['-e', script]);
} else if (_platform == NativePlatform.linux) {
final args = <String>[title, body];
if (icon != null) args.addAll(['-i', icon]);
await _runSimple('notify-send', args);
}
}