Sensor and uses thereof in detecting metal ions