AlgoliaEvent constructor
AlgoliaEvent({})
Implementation
AlgoliaEvent({
required this.eventType,
required this.eventName,
required this.index,
required this.userToken,
this.queryID,
this.objectIDs,
this.timestamp,
this.filters,
this.positions,
}) : assert(
eventName.isNotEmpty && eventName.length <= 64,
'eventName - Format: any ASCII character, '
'except control points with a length between 1 and 64.',
),
assert(
RegExp(r'[a-zA-Z0-9_-]{1,64}').hasMatch(eventName),
'eventName - Format: [a-zA-Z0-9_-]{1,64}',
),
assert(
(objectIDs?.isEmpty ?? true) || (filters?.isEmpty ?? true),
'An event can’t have both objectIDs and filters at the same time.',
),
assert(
!((queryID?.isNotEmpty ?? false) &&
eventType == AlgoliaEventType.click) ||
((positions?.isNotEmpty ?? false) &&
(objectIDs?.isNotEmpty ?? false) &&
positions?.length == objectIDs?.length),
'positions and objectIDs field is required if a queryID is provided. '
'One position must be provided for each objectId. '
'Only include this parameter when sending click events.',
);