Skip to content
pubscout

nearby_connections

4.3.0, released 2 years ago by prerakmann.me

Android plugin for offline peer‑to‑peer data transfer using the Nearby Connections API.

WASM-ready
$ flutter pub add nearby_connections
Source repository

What it does

Exposes the Android Nearby Connections API to Flutter, allowing devices to advertise, discover, and exchange bytes or files without internet. Handles connection lifecycle and payload transmission.

AI-written summary of version 4.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need offline, local networking between Android devices
  • You need to send files or binary data directly between phones

Skip it when

  • You require iOS, web, or desktop support
  • You prefer a cross‑platform solution with fewer native permissions

Strengths

  • Works fully offline using Google’s native Nearby API
  • Supports both byte and file payloads
  • Recent updates keep dependencies current

Weaknesses

  • Android‑only; no iOS/web support
  • Requires many runtime permissions and manifest changes
  • Setup can be verbose and error‑prone

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
0

Add multiple Android permissions (location, Bluetooth, Wi‑Fi, storage) to AndroidManifest.xml, request them at runtime (e.g., via permission_handler), and set compileSdkVersion >=32 if targeting Android 12+.

await Nearby().startAdvertising('myDevice', Strategy.P2P_CLUSTER, onConnectionInitiated: (id, info) {}, onConnectionResult: (id, status) {}, onDisconnected: (id) {}, serviceId: 'com.example.app');

Alternatives

Packages that do the same job and could replace nearby_connections.