flutter_nearby_connections_plus 1.2.1 copy "flutter_nearby_connections_plus: ^1.2.1" to clipboard
flutter_nearby_connections_plus: ^1.2.1 copied to clipboard

Flutter plugin support peer-to-peer connectivity and discovery of nearby devices (maintained fork with bug fixes)

flutter_nearby_connections_plus #

This is a maintained fork of the original flutter_nearby_connections package with bug fixes and improvements.

Credits #

Plugin: https://pub.dev/packages/flutter_nearby_connections_plus

Original License #

This package is based on the original work by Nankai, licensed under BSD 2-Clause License.

✅ Tested Environment #

This package has been thoroughly tested and confirmed working with:

  • Flutter: 3.22.0 (revision 5dcb86f68f)
  • Dart: 3.4.0
  • Engine: f6344b75dc
  • DevTools: 2.34.3

Note: While this package should work with other Flutter versions, the above configuration is verified to work correctly with all features.

Installation #

dependencies:
  flutter_nearby_connections_plus: ^1.2.0

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

Multipeer Connectivity

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

The example app running in IOS

Test on Android device

The example app running in Android

🐛 Issues #

If you encounter any issues, please file them in the issue tracker.

🤝 Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request
1
likes
150
points
44
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin support peer-to-peer connectivity and discovery of nearby devices (maintained fork with bug fixes)

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on flutter_nearby_connections_plus

Packages that implement flutter_nearby_connections_plus