capture method

Future<void> capture({
  1. required String eventName,
  2. Map<String, Object>? properties,
})

Implementation

Future<void> capture({
  required String eventName,
  Map<String, Object>? properties,
}) {
  final propertiesCopy = properties == null ? null : {...properties};

  final currentScreen = _currentScreen;
  if (propertiesCopy != null &&
      !propertiesCopy.containsKey('\$screen_name') &&
      currentScreen != null) {
    propertiesCopy['\$screen_name'] = currentScreen;
  }
  return _posthog.capture(
    eventName: eventName,
    properties: propertiesCopy,
  );
}