diff --git a/android/src/main/kotlin/io/altme/beacon/beacon/BeaconPlugin.kt b/android/src/main/kotlin/io/altme/beacon/beacon/BeaconPlugin.kt index 68adfcf..3f9f2c6 100644 --- a/android/src/main/kotlin/io/altme/beacon/beacon/BeaconPlugin.kt +++ b/android/src/main/kotlin/io/altme/beacon/beacon/BeaconPlugin.kt @@ -275,6 +275,7 @@ class BeaconPlugin : MethodChannel.MethodCallHandler, EventChannel.StreamHandler beaconClient?.connect() ?.catch { error -> Log.e(tag, "connect: ${error.message}") + result.success(mapOf("failure" to error.message)) } ?.onEach { result -> result.getOrNull()?.let { saveAwaitingRequest(it) } } ?.collect { result -> diff --git a/example/lib/main.dart b/example/lib/main.dart index 5ada3f7..d16ae01 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -53,6 +53,11 @@ class _MyHomePageState extends State { startBeacon() async { final Map response = await _beaconPlugin.startBeacon(walletName: "Altme Wallet"); + if (response['failure'] != null) { + final fauilure = json.decode(response['failure'].toString()); + print('fauilure: $fauilure'); + return; + } setState(() { hasPeers = json.decode(response['success'].toString()); });