搜尋套件、儲存庫與 APP 分類

套件詳情v0.4.0

flutter_broadcasts

一個用於透過 Android 意圖和 iOS 通知發送和接收廣播的外掛程式。

AndroidiOS
近 30 天下載
9900
喜歡數
28
Pub 分數
140

安裝套件

flutter pub add flutter_broadcasts

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

flutter_broadcasts 是一個 Flutter 插件,透過 Android 意圖和 iOS 通知實現跨平台通訊。它允許應用程式發送和接收廣播,從而促進兩個平台上的應用間訊息傳遞和事件處理。在 Android 上,它利用原生 Intent 系統實現可靠的訊息傳遞;而在 iOS 上,則使用本機通知和推播通知來模擬廣播行為。該插件無需了解原生程式碼即可簡化與平台特定訊息系統的整合。適用於背景任務協調、應用間通訊或根據外部事件觸發動作等情境。

適用情境

  • 應用間訊息傳遞
  • 後台任務協調
  • 事件驅動的應用架構
  • 推送通知觸發
  • 系統事件監聽

主要特色

  • Android Intent 支援
  • 基於iOS通知的廣播
  • 跨平台一致性
  • 用於發送/接收的簡單 API
  • 無需原生程式碼

適合對象

  • 開發模組化應用的開發者
  • 需要背景通訊的應用程式
  • 與系統級事件的整合
  • 跨平台訊息傳遞需求
  • 使用事件驅動設計的應用程式

使用建議

  • 由於通知限制,iOS 上的功能有限
  • 需要正確的權限處理
  • 可能需要背景執行設定
  • 不適合高頻率訊息傳遞
  • 平台特定的行為差異

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter Broadcasts

A plugin for sending and receiving broadcasts with Android intents and iOS notifications. The API is inspired by Android's BroadcastReceivers and uses the NotificationCenter internally on iOS.

Quick Start

First install the package via pub.dev. Then subscribe to broadcasts like this:

BroadcastReceiver receiver = BroadcastReceiver(
  names: <String>["de.kevlatus.broadcast"],
);
receiver.messages.listen(print);
receiver.start();

Roadmap

This package is currently under construction. Below you can find a quick overview of its implementation status. Contributions are welcome, if you are missing features.

  • [x] implement broadcast receiver on Android
  • [x] implement broadcast sending on Android
  • [ ] implement NSNotificationCenter subscriptions on iOS
  • [ ] implement NSNotificationCenter notifications on iOS

Contributions

Contributions are much appreciated, but keep in mind that this package is supposed to be generic and only expose native broadcast APIs like Android's BroadcastReceivers and the iOS NotificiationCenter. Consider creating separate packages for sending and receiving specific broadcast instances.

If you have any ideas for extending this package to other platforms, feel free to open a pull request or raise an issue.

所屬分類

原始碼儲存庫

使用此套件的專案