startEvent static method

Future<String?> startEvent(
  1. String key
)

starts a timed event returns error or success message

Implementation

static Future<String?> startEvent(String key) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "startEvent"';
    log('startEvent, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "startEvent":[$key]');
  if (key.isEmpty) {
    String error = "startEvent, Can't start event with empty key";
    log(error);
    return 'Error : $error';
  }
  List<String> args = [];
  args.add(key);

  final String? result = await _channel.invokeMethod('startEvent', <String, dynamic>{'data': json.encode(args)});

  return result;
}