Skip to content

Commit

Permalink
Reformat code, Update version to 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vietdq2701 committed Sep 17, 2020
1 parent 8fc11d0 commit 61cd20f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.5

* Reformat code

## 0.0.4

* Fix syntax error
Expand Down
10 changes: 7 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_nearby_connections/flutter_nearby_connections.dart';
import 'package:fluttertoast/fluttertoast.dart';
Expand Down Expand Up @@ -113,7 +114,8 @@ class _DevicesListScreenState extends State<DevicesListScreen> {
});
});

receivedDataSubscription = nearbyService.dataReceivedSubscription(callback: (data) {
receivedDataSubscription =
nearbyService.dataReceivedSubscription(callback: (data) {
Fluttertoast.showToast(msg: jsonEncode(data));
});

Expand Down Expand Up @@ -264,8 +266,10 @@ class _DevicesListScreenState extends State<DevicesListScreen> {
FlatButton(
child: Text("Send"),
onPressed: () {
String jsonData = '{ "message": \" ${myController.text}\" }';
nearbyService.sendMessage(device.deviceID, jsonDecode(jsonData));
String jsonData =
'{ "message": \" ${myController.text}\" }';
nearbyService.sendMessage(
device.deviceID, jsonDecode(jsonData));
myController.text = '';
},
)
Expand Down
5 changes: 2 additions & 3 deletions lib/src/nearby_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ class NearbyService {
}

/// Sends a message encapsulated in a Data instance to nearby peers.
FutureOr<void> sendMessage(String deviceID, Map<String,dynamic> argument) {
FutureOr<void> sendMessage(String deviceID, Map<String, dynamic> argument) {
argument['device_id'] = deviceID;
_channel.invokeMethod(
_sendMessage, jsonEncode(argument));
_channel.invokeMethod(_sendMessage, jsonEncode(argument));
}

/// [stateChangedSubscription] helps you listen to the changes of peers with
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_nearby_connections
description: Flutter plugin supports peer-to-peer connectivity and discovers nearby devices for Android and IOS
version: 0.0.4
version: 0.0.5
author: [email protected]
homepage: https://github.com/VNAPNIC/flutter_nearby_connections

Expand Down

0 comments on commit 61cd20f

Please sign in to comment.