addEvent method

Future<void> addEvent({
  1. required String eventName,
  2. required EventType eventType,
  3. Map<String, dynamic>? eventData,
})

Implementation

Future<void> addEvent({
  required String eventName,
  required EventType eventType,
  Map<String, dynamic>? eventData,
}) async {
  final user = sdkDataPersistenceService.currentUser();
  if (user != null) {
    final request = AddEventRequest(
      email: user.email,
      eventName: eventName,
      eventType: eventType,
      eventData: eventData,
    );
    await network.addEvent(request: request);
  } else {
    throw const NoUserFoundException(
        'No User founded please call createUser First');
  }
}