diff --git a/example/.gitignore b/example/.gitignore
index 07488ba..0fa6b67 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -15,56 +15,32 @@
*.iws
.idea/
-# Visual Studio Code related
-.vscode/
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
+**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
+.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
-# Android related
-**/android/**/gradle-wrapper.jar
-**/android/.gradle
-**/android/captures/
-**/android/gradlew
-**/android/gradlew.bat
-**/android/local.properties
-**/android/**/GeneratedPluginRegistrant.java
+# Web related
+lib/generated_plugin_registrant.dart
-# iOS/XCode related
-**/ios/**/*.mode1v3
-**/ios/**/*.mode2v3
-**/ios/**/*.moved-aside
-**/ios/**/*.pbxuser
-**/ios/**/*.perspectivev3
-**/ios/**/*sync/
-**/ios/**/.sconsign.dblite
-**/ios/**/.tags*
-**/ios/**/.vagrant/
-**/ios/**/DerivedData/
-**/ios/**/Icon?
-**/ios/**/Pods/
-**/ios/**/.symlinks/
-**/ios/**/profile
-**/ios/**/xcuserdata
-**/ios/.generated/
-**/ios/Flutter/App.framework
-**/ios/Flutter/Flutter.framework
-**/ios/Flutter/Generated.xcconfig
-**/ios/Flutter/app.flx
-**/ios/Flutter/app.zip
-**/ios/Flutter/flutter_assets/
-**/ios/ServiceDefinitions.json
-**/ios/Runner/GeneratedPluginRegistrant.*
+# Symbolication related
+app.*.symbols
-# Exceptions to above rules.
-!**/ios/**/default.mode1v3
-!**/ios/**/default.mode2v3
-!**/ios/**/default.pbxuser
-!**/ios/**/default.perspectivev3
-!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
+# Obfuscation related
+app.*.map.json
+
+# Android Studio will place build artifacts here
+/android/app/debug
+/android/app/profile
+/android/app/release
diff --git a/example/.metadata b/example/.metadata
index 033ad2a..526e166 100644
--- a/example/.metadata
+++ b/example/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b
+ revision: 60bd88df915880d23877bfc1602e8ddcf4c4dd2a
channel: stable
project_type: app
diff --git a/example/README.md b/example/README.md
index eb9393f..71ac478 100644
--- a/example/README.md
+++ b/example/README.md
@@ -2,8 +2,15 @@
Demonstrates how to use the nearby_connections plugin.
-Checkout the [**Example**](https://github.com/mannprerak2/nearby_connections/tree/master/example) repository for implementation of sending bytes and files.
+## Getting Started
-Other examples using this is
- - [Monoply Money Handler](https://github.com/mannprerak2/monopoly_money_game)
+This project is a starting point for a Flutter application.
+A few resources to get you started if this is your first Flutter project:
+
+- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
+
+For help getting started with Flutter, view our
+[online documentation](https://flutter.dev/docs), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
diff --git a/example/android/.gitignore b/example/android/.gitignore
new file mode 100644
index 0000000..0a741cb
--- /dev/null
+++ b/example/android/.gitignore
@@ -0,0 +1,11 @@
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
+GeneratedPluginRegistrant.java
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+key.properties
diff --git a/example/android/.project b/example/android/.project
deleted file mode 100644
index 17c95d4..0000000
--- a/example/android/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- android
- Project android_ created by Buildship.
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index 2b6d83b..0000000
--- a/example/android/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=/usr/lib/jvm/java-11-openjdk-amd64
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=true
-show.console.view=true
-show.executions.view=true
diff --git a/example/android/app/.classpath b/example/android/app/.classpath
deleted file mode 100644
index 4a04201..0000000
--- a/example/android/app/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/example/android/app/.project b/example/android/app/.project
deleted file mode 100644
index ac485d7..0000000
--- a/example/android/app/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- app
- Project app created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
diff --git a/example/android/app/.settings/org.eclipse.buildship.core.prefs b/example/android/app/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index b1886ad..0000000
--- a/example/android/app/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index e9f568f..1825f06 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -25,23 +25,20 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
-
- lintOptions {
- disable 'InvalidPackage'
- }
+ compileSdkVersion 30
defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.pkmnapps.nearby_connections_example"
minSdkVersion 16
- targetSdkVersion 28
+ targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
+ // TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
@@ -51,9 +48,3 @@ android {
flutter {
source '../..'
}
-
-dependencies {
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.1.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
-}
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index d175df9..5352251 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -10,33 +10,42 @@
-
-
-
+
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/NormalTheme"
+ />
+
+
+
+
diff --git a/example/android/app/src/main/java/com/pkmnapps/nearby_connections_example/MainActivity.java b/example/android/app/src/main/java/com/pkmnapps/nearby_connections_example/MainActivity.java
index 55c741f..b9007db 100644
--- a/example/android/app/src/main/java/com/pkmnapps/nearby_connections_example/MainActivity.java
+++ b/example/android/app/src/main/java/com/pkmnapps/nearby_connections_example/MainActivity.java
@@ -1,16 +1,6 @@
package com.pkmnapps.nearby_connections_example;
-
-import android.os.Bundle;
-
-
-import io.flutter.app.FlutterActivity;
-import io.flutter.plugins.GeneratedPluginRegistrant;
+import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- GeneratedPluginRegistrant.registerWith(this);
- }
-}
\ No newline at end of file
+}
diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 0000000..f74085f
--- /dev/null
+++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..449a9f9
--- /dev/null
+++ b/example/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml
index 00fa441..d74aa35 100644
--- a/example/android/app/src/main/res/values/styles.xml
+++ b/example/android/app/src/main/res/values/styles.xml
@@ -1,8 +1,18 @@
-
+
+
diff --git a/example/android/build.gradle b/example/android/build.gradle
index 73683bf..c9e3db0 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -5,17 +5,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.2.1'
- }
- subprojects {
- project.configurations.all {
- resolutionStrategy.eachDependency { details ->
- if (details.requested.group == 'androidx.core'
- && !details.requested.name.contains('androidx')) {
- details.useVersion "1.0.1"
- }
- }
- }
+ classpath 'com.android.tools.build:gradle:4.1.0'
}
}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index b6e61b6..94adc3a 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,4 +1,3 @@
-android.enableJetifier=true
-android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
-android.enableR8=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 2819f02..bc6a58a 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
diff --git a/example/android/settings.gradle b/example/android/settings.gradle
index 5a2f14f..44e62bc 100644
--- a/example/android/settings.gradle
+++ b/example/android/settings.gradle
@@ -1,15 +1,11 @@
include ':app'
-def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
-def plugins = new Properties()
-def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
-if (pluginsFile.exists()) {
- pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
-plugins.each { name, path ->
- def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
- include ":$name"
- project(":$name").projectDir = pluginDirectory
-}
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/example/ios/Podfile b/example/ios/Podfile
deleted file mode 100644
index f7d6a5e..0000000
--- a/example/ios/Podfile
+++ /dev/null
@@ -1,38 +0,0 @@
-# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
-
-# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
-ENV['COCOAPODS_DISABLE_STATS'] = 'true'
-
-project 'Runner', {
- 'Debug' => :debug,
- 'Profile' => :release,
- 'Release' => :release,
-}
-
-def flutter_root
- generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
- unless File.exist?(generated_xcode_build_settings_path)
- raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
- end
-
- File.foreach(generated_xcode_build_settings_path) do |line|
- matches = line.match(/FLUTTER_ROOT\=(.*)/)
- return matches[1].strip if matches
- end
- raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
-end
-
-require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
-
-flutter_ios_podfile_setup
-
-target 'Runner' do
- flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
-end
-
-post_install do |installer|
- installer.pods_project.targets.each do |target|
- flutter_additional_ios_build_settings(target)
- end
-end
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 860d146..4eb4229 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -37,7 +37,7 @@ class _MyBodyState extends State
{
final Strategy strategy = Strategy.P2P_STAR;
Map endpointMap = Map();
- File tempFile; //reference to the file currently being transferred
+ File? tempFile; //reference to the file currently being transferred
Map map =
Map(); //store filename mapped to corresponding payloadId
@@ -149,7 +149,7 @@ class _MyBodyState extends State {
},
onDisconnected: (id) {
showSnackbar(
- "Disconnected: ${endpointMap[id].endpointName}, id $id");
+ "Disconnected: ${endpointMap[id]!.endpointName}, id $id");
setState(() {
endpointMap.remove(id);
});
@@ -207,7 +207,7 @@ class _MyBodyState extends State {
endpointMap.remove(id);
});
showSnackbar(
- "Disconnected from: ${endpointMap[id].endpointName}, id $id");
+ "Disconnected from: ${endpointMap[id]!.endpointName}, id $id");
},
);
},
@@ -220,7 +220,7 @@ class _MyBodyState extends State {
},
onEndpointLost: (id) {
showSnackbar(
- "Lost discovered Endpoint: ${endpointMap[id].endpointName}, id $id");
+ "Lost discovered Endpoint: ${endpointMap[id]!.endpointName}, id $id");
},
);
showSnackbar("DISCOVERING: " + a.toString());
@@ -266,7 +266,7 @@ class _MyBodyState extends State {
ElevatedButton(
child: Text("Send File Payload"),
onPressed: () async {
- PickedFile file =
+ PickedFile? file =
await ImagePicker().getImage(source: ImageSource.gallery);
if (file == null) return;
@@ -319,7 +319,7 @@ class _MyBodyState extends State {
id,
onPayLoadRecieved: (endid, payload) async {
if (payload.type == PayloadType.BYTES) {
- String str = String.fromCharCodes(payload.bytes);
+ String str = String.fromCharCodes(payload.bytes!);
showSnackbar(endid + ": " + str);
if (str.contains(':')) {
@@ -329,9 +329,9 @@ class _MyBodyState extends State {
String fileName = (str.split(':')[1]);
if (map.containsKey(payloadId)) {
- if (await tempFile.exists()) {
- tempFile.rename(
- tempFile.parent.path + "/" + fileName);
+ if (await tempFile!.exists()) {
+ tempFile!.rename(
+ tempFile!.parent.path + "/" + fileName);
} else {
showSnackbar("File doesn't exist");
}
@@ -342,7 +342,7 @@ class _MyBodyState extends State {
}
} else if (payload.type == PayloadType.FILE) {
showSnackbar(endid + ": File transfer started");
- tempFile = File(payload.filePath);
+ tempFile = File(payload.filePath!);
}
},
onPayloadTransferUpdate: (endid, payloadTransferUpdate) {
@@ -360,8 +360,8 @@ class _MyBodyState extends State {
if (map.containsKey(payloadTransferUpdate.id)) {
//rename the file now
- String name = map[payloadTransferUpdate.id];
- tempFile.rename(tempFile.parent.path + "/" + name);
+ String name = map[payloadTransferUpdate.id]!;
+ tempFile!.rename(tempFile!.parent.path + "/" + name);
} else {
//bytes not received till yet
map[payloadTransferUpdate.id] = "";
diff --git a/example/pubspec.lock b/example/pubspec.lock
index d232d02..f2994a0 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -43,13 +43,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
- cupertino_icons:
- dependency: "direct main"
- description:
- name: cupertino_icons
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.1.3"
fake_async:
dependency: transitive
description:
@@ -68,40 +61,59 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.11"
+ version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.2"
+ version: "0.13.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
- version: "3.1.4"
+ version: "4.0.0"
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
- version: "0.6.7+21"
+ version: "0.7.4"
+ image_picker_for_web:
+ dependency: transitive
+ description:
+ name: image_picker_for_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.0"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.1"
+ version: "2.0.1"
+ js:
+ dependency: transitive
+ description:
+ name: js
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.6.3"
matcher:
dependency: transitive
description:
@@ -117,7 +129,7 @@ packages:
source: hosted
version: "1.3.0"
nearby_connections:
- dependency: "direct dev"
+ dependency: "direct main"
description:
path: ".."
relative: true
@@ -136,14 +148,14 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
- version: "1.9.2"
+ version: "1.11.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.3"
+ version: "2.0.0"
sky_engine:
dependency: transitive
description: flutter
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 2660362..72191c7 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -1,27 +1,32 @@
name: nearby_connections_example
description: Demonstrates how to use the nearby_connections plugin.
-publish_to: 'none'
+
+# The following line prevents the package from being accidentally published to
+# pub.dev using `pub publish`. This is preferred for private packages.
+publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
- # The following adds the Cupertino Icons font to your application.
- # Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^0.1.2
- image_picker: ^0.6.1+2
+ image_picker: ^0.7.4
+ nearby_connections:
+ # When depending on this package from a real application you should use:
+ # nearby_connections: ^x.y.z
+ # See https://dart.dev/tools/pub/dependencies#version-constraints
+ # The example app is bundled with the plugin so we use a path dependency on
+ # the parent directory to use the current plugin's version.
+ path: ../
+
dev_dependencies:
flutter_test:
sdk: flutter
- nearby_connections:
- path: ../
-
# For information on the generic Dart part of this file, see the
-# following page: https://www.dartlang.org/tools/pub/pubspec
+# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
@@ -33,8 +38,8 @@ flutter:
# To add assets to your application, add an assets section, like this:
# assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
+ # - images/a_dot_burr.jpeg
+ # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
diff --git a/lib/src/nearby.dart b/lib/src/nearby.dart
index 0b1e3f1..853d7bc 100644
--- a/lib/src/nearby.dart
+++ b/lib/src/nearby.dart
@@ -36,8 +36,7 @@ class Nearby {
endpointId,
ConnectionInfo(
endpointName, authenticationToken, isIncomingConnection));
-
- return null;
+ break;
case "ad.onConnectionResult":
String endpointId = args['endpointId'] ?? '-1';
Status statusCode =
@@ -45,13 +44,13 @@ class Nearby {
_advertConnectionResult?.call(endpointId, statusCode);
- return null;
+ break;
case "ad.onDisconnected":
String endpointId = args['endpointId'] ?? '-1';
_advertDisconnected?.call(endpointId);
- return null;
+ break;
case "dis.onConnectionInitiated":
String endpointId = args['endpointId'] ?? '-1';
@@ -64,7 +63,7 @@ class Nearby {
ConnectionInfo(
endpointName, authenticationToken, isIncomingConnection));
- return null;
+ break;
case "dis.onConnectionResult":
String endpointId = args['endpointId'] ?? '-1';
Status statusCode =
@@ -72,13 +71,13 @@ class Nearby {
_discoverConnectionResult?.call(endpointId, statusCode);
- return null;
+ break;
case "dis.onDisconnected":
String endpointId = args['endpointId'] ?? '-1';
_discoverDisconnected?.call(endpointId);
- return null;
+ break;
case "dis.onEndpointFound":
String endpointId = args['endpointId'] ?? '-1';
@@ -86,13 +85,13 @@ class Nearby {
String serviceId = args['serviceId'] ?? '-1';
_onEndpointFound?.call(endpointId, endpointName, serviceId);
- return null;
+ break;
case "dis.onEndpointLost":
String endpointId = args['endpointId'] ?? '-1';
_onEndpointLost?.call(endpointId);
- return null;
+ break;
case "onPayloadReceived":
String endpointId = args['endpointId'] ?? '-1';
int type = args['type'] ?? PayloadType.NONE;
@@ -127,8 +126,8 @@ class Nearby {
_onPayloadTransferUpdate?.call(endpointId, payloadTransferUpdate);
break;
}
- return null;
- } as Future Function(MethodCall)?);
+ return Future.value();
+ });
}
//for advertisers
@@ -387,7 +386,7 @@ class Nearby {
/// You must also send a bytes payload to send the filename and extension
/// so that receiver can rename the file accordingly
/// Send the payloadID and filename to receiver as bytes payload
- Future sendFilePayload(String endpointId, String filePath) async {
+ Future sendFilePayload(String endpointId, String filePath) async {
return await _channel.invokeMethod(
'sendFilePayload',
{