How to unregister events

If I register an event like this:

this.registerEvent(this.app.workspace.on('file-open', async (file) => {
      // some code
    }))

is there any way to “unsubscribe” from that event without disabling the plugin? something like removeListener as suggested in this stack overflow answer?

that is exactly what I was looking for, thanks