How to disable the context menu in Flutter (2.x, Web / Browser) when e.g. right click or in touch long press on mobile devices (e.g. DevTools mobile view).
I come from web development with Angular etc. In HTML/JS it works like:
document.body.addEventListener('contextmenu', (event) => {
event.preventDefault();
});
But how to do this on Flutter? Is there contextmenu event which can be disabled. Blocking right click will not work. Because it also appears on mobile long press (on release).
BrowserContextMenu.disableContextMenu()
Here is the documentation for it: api.flutter.dev/flutter/services/BrowserContextMenu-class.html – Sextet