How to check collider and not collider between two objects?

Hello everyone.
I would like to check collision (or overlap) between two objects if it collision
I can check collision, but no idea how to check two objects out of collision
create:
candosomething = false;
this.physics.add.collider(player, platforms, check_collision, null, this);

function check_collision (player, platforms)
{
    candosomething = true;
}

I tried on update tag, but finally…not work

if(this.physics.add.collider(player, platforms){
  candosomething = true;
}else{
 candosomething = false;
}

Anyidea how to check collision and out of the collision between two objects?
Thank you very much

I think you just need to reset the flag at the end of update, see also

candosomething = false;
this.physics.add.collider(player, platforms, check_collision, null, this);

function check_collision (player, platforms)
{
    candosomething = true;
}

function update() {
    ...
    if (candosomething) {
    }
    ...
    candosomething = false;
}