big time, in fact you are more likely to catch rats or mice by using chocolate in a trap, than cheese.
If it is a pet rat, it would be cruel to give it chocolate. Chocolate contains a chemical called theobromine and I'm not sure the rat can metabolise it properly.
Mind you, they can live on soap, human dung etc so I don't suppose a nice bit of chocolate will hurt them much. But if you feel affectionate towards your rat, don't give it chocolate.