sendFilePayload method

  1. @override
void sendFilePayload(
  1. File file,
  2. String channel
)
override

Implementation

@override
void sendFilePayload(File file, String channel) {
  //TODO: review the format
  final bytes = file.readAsBytesSync();

  var mime = lookupMimeType(file.path);
  String base64Image = "data:" +
      (mime ?? "text/plain") +
      ";base64," +
      base64Encode(bytes) +
      "," +
      basename(file.path);

  sendPayload(base64Image, channel);
}