如何在 vala 中创建通知 class

How to create a notification class in vala

我正在学习 vala 语言,我想创建一个服务来触发通知。 那是我的代码

public class Services.Notifications : Glib.Object {
  

  public void sendNotification (string title, string body,string icon_name, GLib.NotificationPriority priority) {
      var notification = new Notification (title);
      notification.set_body (body);
      notification.set_icon (new ThemedIcon (icon_name));
      notification.set_priority (priority);

      send_notification ("com.github.andirsun.myapp", notification);
  }
}

但是我遇到了这个错误

class Notifications: null
base type `null' of class `Services.Notifications' is not an object type

我在 meson.build 文件中添加了文件 Services/Notification.vala 有点不起作用

你的基地 class 的名字有错字 - Glib.Object 应该是 GLib.Object(注意大写 L