Skip to content

Commit

Permalink
send beacon connection error from Kotlin to Flutter
Browse files Browse the repository at this point in the history
  • Loading branch information
TalebRafiepour authored and bibash28 committed Nov 9, 2022
1 parent 14d39d8 commit e243c5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
5 changes: 5 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class _MyHomePageState extends State<MyHomePage> {
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());
});
Expand Down

0 comments on commit e243c5a

Please sign in to comment.