logLocalEvent static method

void logLocalEvent(
  1. String description, {
  2. String prefix = "LOG",
  3. String separator = "|",
})

Logs event to EventChannel. This is used to send events to the EventChannel for integration into existing communication flow. The event will be sent as a String with the following format:

  • (if prefix is not empty): "prefix|description", where '|' is separator
  • (if prefix is empty): "description"

Implementation

static void logLocalEvent(String description, {String prefix = "LOG", String separator = "|"}) async {
  if (!kIsWeb) {
    throw UnimplementedError("Use eventChannel() via sendPhoneEvents on platform implementation");
  }
  // eventChannel.binaryMessenger.handlePlatformMessage(
  //   _kEventChannelName,
  //   const StandardMethodCodec().encodeSuccessEnvelope(description),
  //   (ByteData? data) {},
  // );
  String message = "";
  if (prefix.isEmpty) {
    message = description;
  } else {
    message = "$prefix$separator$description";
  }

  // Send events to EventChannel for integration into existing communication flow
  callEventsController.add(message);
}