mirror of
https://github.com/hackku21/nearby_connections.git
synced 2026-03-02 03:49:22 +00:00
published 1.0.0
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user