The constitution has been mentioned by many people so far. Sure. That does answer your question in a literal sense. However, which dictators throughout history have ever cared about the laws in their country?
Besides laws and the constitution, what many Canadians would be reluctant to mention is the fact that there are 38+ million people in Canada, many of whom are armed. The prime minister is just one person. Sure, they control the military, but Canada is huge! Armed civilians using guerilla tactics would be a serious challenge for Canada's military, even if they backed the would be dictator, which I think would be unlikely, especially by a majority.
Just to be clear to our southern neighbours, we don't need “the 2nd” to defend ourselves from a would be dictator. We are just fine. And we have lots of guns.