denyReport static method

EventHandler? denyReport(
  1. OverlayItem item, {
  2. void onComplete(
    1. GemError error
    )?,
})

Provides negative feedback (downvote) for an inaccurate report.

Denies that a reported event is accurate or still in effect, decreasing the report's score. Reports with many downvotes are automatically removed to maintain information quality. Use when the reported condition no longer exists or was never accurate.

Each user can confirm or deny a report only once. The operation executes asynchronously with result delivered via onComplete callback.

Parameters

  • item: The social report OverlayItem to deny. Must be a valid social report overlay item obtained from map selection, search, or alarm notification.
  • onComplete: Callback invoked when operation completes or fails. Called with:

Returns

  • EventHandler if operation was successfully initiated (use with cancel).
  • null if operation could not be started.

See also:

  • confirmReport - Provides positive feedback for accurate reports.
  • deleteReport - Deletes own report completely (owner only).
  • AlarmService - Provides notifications about incoming social reports.

Implementation

static EventHandler? denyReport(
  final OverlayItem item, {
  final void Function(GemError error)? onComplete,
}) {
  final EventDrivenProgressListener progListener =
      EventDrivenProgressListener();
  GemKitPlatform.instance.registerEventHandler(progListener.id, progListener);

  progListener.registerOnCompleteWithData((final int err, _, _) {
    GemKitPlatform.instance.unregisterEventHandler(progListener.id);
    onComplete?.call(GemErrorExtension.fromCode(err));
  });

  final OperationResult result = staticMethod(
    'SocialOverlay',
    'denyReport',
    args: <String, dynamic>{
      'item': item.pointerId,
      'listener': progListener.id,
    },
  );

  final GemError errorCode = GemErrorExtension.fromCode(result['result']);

  if (errorCode != GemError.scheduled) {
    GemKitPlatform.instance.unregisterEventHandler(progListener.id);
    onComplete?.call(errorCode);
    return null;
  }

  return progListener;
}