error fixes

This commit is contained in:
Prerak Mann 2019-05-12 01:30:07 +05:30
parent c118ce5096
commit 9ff7aa546f
2 changed files with 10 additions and 16 deletions

View File

@ -201,10 +201,13 @@ class _MyBodyState extends State<Body> {
),
RaisedButton(
child: Text("Reject Connection"),
onPressed: () {
onPressed: () async {
Navigator.pop(context);
Nearby().rejectConnection(id);
try {
await Nearby().rejectConnection(id);
} catch (e) {
showSnackbar(e);
}
},
),
],

View File

@ -230,7 +230,7 @@ class Nearby {
Future<bool> rejectConnection(String endpointId) async {
return await _channel.invokeMethod(
'acceptConnection',
'rejectConnection',
<String, dynamic>{
'endpointId': endpointId,
},
@ -248,18 +248,6 @@ class Nearby {
}
}
abstract class ConnectionLifecycleCallback {
void onConnectionInitiated(String endpointId, ConnectionInfo connectionInfo);
void onConnectionResult(String endpointId, Status status);
void onDisconnected(String endpointId);
}
abstract class EndpointDiscoveryCallback {
void onEndpointFound(
String endpointId, String endpointName, String serviceId);
void onEndpointLost(String endpointId);
}
class ConnectionInfo {
String endpointName, authenticationToken;
bool isIncomingConnection;
@ -267,3 +255,6 @@ class ConnectionInfo {
ConnectionInfo(
this.endpointName, this.authenticationToken, this.isIncomingConnection);
}
//TODO remove errors on failure for smooth experience
//TODO expose only relevant parts as library
//TODO publish to pub.dartlang