mirror of
https://github.com/hackku21/nearby_connections.git
synced 2024-10-27 19:14:01 +00:00
error fixes
This commit is contained in:
parent
c118ce5096
commit
9ff7aa546f
@ -201,10 +201,13 @@ class _MyBodyState extends State<Body> {
|
|||||||
),
|
),
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
child: Text("Reject Connection"),
|
child: Text("Reject Connection"),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
try {
|
||||||
Nearby().rejectConnection(id);
|
await Nearby().rejectConnection(id);
|
||||||
|
} catch (e) {
|
||||||
|
showSnackbar(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -230,7 +230,7 @@ class Nearby {
|
|||||||
|
|
||||||
Future<bool> rejectConnection(String endpointId) async {
|
Future<bool> rejectConnection(String endpointId) async {
|
||||||
return await _channel.invokeMethod(
|
return await _channel.invokeMethod(
|
||||||
'acceptConnection',
|
'rejectConnection',
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'endpointId': endpointId,
|
'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 {
|
class ConnectionInfo {
|
||||||
String endpointName, authenticationToken;
|
String endpointName, authenticationToken;
|
||||||
bool isIncomingConnection;
|
bool isIncomingConnection;
|
||||||
@ -267,3 +255,6 @@ class ConnectionInfo {
|
|||||||
ConnectionInfo(
|
ConnectionInfo(
|
||||||
this.endpointName, this.authenticationToken, this.isIncomingConnection);
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user