flutter_nearby_connections
Flutter 插件支援 Android 與 iOS 的點對點連接以及附近裝置的發現
- 星標
- 133
- 分支
- 100
- 最近推送(UTC)
- 2024年6月15日
- 專案狀態
- 未封存
原始 README
以下為英文專案原文快照,最新內容請造訪 GitHub。
flutter_nearby_connections
flutter nearby connections
Plugin: https://pub.dev/packages/flutter_nearby_connections
Flutter plugin supports peer-to-peer connectivity and discovers nearby devices for Android and IOS
The flutter_nearby_connections plugin supports the discovery of services provided by nearby devices. Moreover, the flutter_nearby_connections plugin also supports communicating with those services through message-based data, streaming data, and resources (such as files). The framework uses infrastructure Wi-Fi networks, peer-to-peer Wi-Fi and Bluetooth Personal Area Networks (PAN) for the underlying transport over UDP. The project is based on
Android
Nearby Connections API (Bluetooth & hotspot) Support Strategy: Strategy.P2P_CLUSTER, Strategy.P2P_STAR, Strategy.P2P_POINT_TO_POINT
Wi-Fi P2P (only wifi hotspot no internet) Support Strategy: Strategy.Wi_Fi_P2P
IOS
We use the NearbyConnections API, but Flutter methods are based on the concept of Multipeer Connectivity IOS.
Methods provided:
startAdvertisingPeer, startBrowsingForPeers, stopAdvertisingPeer
We separate the dependencies of the MCNearbyServiceAdvertiser, MCNearbyServiceBrowser and MCSession classes. All of the methods will be implemented in the NearbyService class.
Noted
-
Android doesn't support emulator only support real devices
-
On iOS 14, need to define in Info.plist
<key>NSBonjourServices</key>
<array>
<string>_{YOUR_SERVICE_TYPE}._tcp</string>
</array>
<key>UIRequiresPersistentWiFi</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>{YOUR_DESCRIPTION}</string>
in this case, YOUR_SERVICE_TYPE is 'mp-connection' (you can define it)
nearbyService.init(
serviceType: 'mp-connection',
strategy: Strategy.P2P_CLUSTER,
Test on IOS device

Test on Android device

Visitors Count
分類
使用的依賴
依賴清單 2 項
- flutter
{"sdk":"flutter"} - flutter_test開發依賴
{"sdk":"flutter"}
如何選擇適合專案的儲存庫?
先依使用情境篩選,再比較專案活躍情況,最後到原始儲存庫確認使用要求。
- 透過儲存庫名稱、作者或描述搜尋,再依技術分類縮小範圍。
- 綜合星標、分支與最近推送比較專案;星標反映社群關注,不保證品質。
- 使用前在 GitHub 確認 README、授權條款與 Issues。
來源與維護
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗