Black hole shadow as a standard ruler in cosmology