如何为windows flutter app实现推送通知?

问题描述 投票:0回答:1

我正在尝试在 Windows Flutter 应用程序上实现推送通知,但找不到任何插件。

我使用了 firebase_messaging 插件来获取其他平台(如 android、iOS、MacOS 和 Web)的 fcmToken,但它不支持 Windows 平台,但我也需要在 Windows 上实现此功能。


Future<String?> getFcmToken() async {
    try {
      String? token;
      if (kIsWeb || Platform.isAndroid || Platform.isIOS || Platform.isMacOS) {
        token = await firebaseMessaging.getToken();
      }else if (Platform.isWindows) {
        token = '';
      }
     
      debugPrint("FCM TOKEN--------------->$token");
      return token;
    } catch (e) {
      debugPrint("FCM TOken error ----------->$e");
      rethrow;
    }
  }
flutter windows dart push-notification
1个回答
0
投票

在 pub 上查看此软件包:windows_notification

此软件包将允许您发送带有文本、小或大图像的通知。它甚至允许您清除通知历史记录。

© www.soinside.com 2019 - 2024. All rights reserved.