published 1.0.0

This commit is contained in:
Prerak Mann
2019-08-12 00:37:27 +05:30
parent 4d666c42a5
commit dcd86e885f
4 changed files with 24 additions and 5 deletions

View File

@@ -4,15 +4,24 @@ import 'dart:typed_data';
import 'package:nearby_connections/src/defs.dart';
/// Bytes may be null if [Payload.type] is not [PayloadType.BYTES]
/// File may be null if [Payload.type] is not [PayloadType.FILE]
///
/// Filepath is the complete filepath(with name) of the file
///
/// The file at this location is incomplete until payloadTransferUpdate
/// gives SUCCESS for this payloadId
class Payload {
int id;
PayloadType type;
Uint8List bytes;
String filePath;
Payload({
this.id,
this.bytes,
this.type = PayloadType.NONE,
this.filePath,
});
}

View File

@@ -96,11 +96,13 @@ class Nearby {
int type = args['type'];
Uint8List bytes = args['bytes'];
int payloadId = args['payloadId'];
String filePath = args['filePath'];
Payload payload = Payload(
type: PayloadType.values[type],
bytes: bytes,
id: payloadId,
filePath: filePath,
);
_onPayloadReceived?.call(endpointId, payload);
@@ -342,4 +344,4 @@ class Nearby {
},
);
}
}
}