Update example and plugin. (#32)

* Update example to null safety, fix int? -> int for sendFilePayload

* Fixed example and plugin errors when running on sound null safety
This commit is contained in:
Prerak Mann 2021-04-09 15:31:39 +05:30 committed by GitHub
parent 4c22d91e06
commit 32cace5af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 187 additions and 261 deletions

58
example/.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -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.

11
example/android/.gitignore vendored Normal file
View File

@ -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

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>android</name>
<comment>Project android_ created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@ -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

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>app</name>
<comment>Project app created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
connection.project.dir=..
eclipse.preferences.version=1

View File

@ -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'
}

View File

@ -10,33 +10,42 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
<application
android:label="nearby_connections_example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>

View File

@ -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);
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -1,8 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -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'
}
}

View File

@ -1,4 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -37,7 +37,7 @@ class _MyBodyState extends State<Body> {
final Strategy strategy = Strategy.P2P_STAR;
Map<String, ConnectionInfo> endpointMap = Map();
File tempFile; //reference to the file currently being transferred
File? tempFile; //reference to the file currently being transferred
Map<int, String> map =
Map(); //store filename mapped to corresponding payloadId
@ -149,7 +149,7 @@ class _MyBodyState extends State<Body> {
},
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<Body> {
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<Body> {
},
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<Body> {
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<Body> {
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<Body> {
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<Body> {
}
} 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<Body> {
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] = "";

View File

@ -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

View File

@ -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.

View File

@ -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<dynamic> 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<int?> sendFilePayload(String endpointId, String filePath) async {
Future<int> sendFilePayload(String endpointId, String filePath) async {
return await _channel.invokeMethod(
'sendFilePayload',
<String, dynamic>{