Dermott has to take less to fit into the Leafs cap structure, because that have zero flexibility. It does raise the question: what is a comparable contract for Dunn?
Perhaps the best recent comparable is Jacob Trouba, who was 22 and coming off his ELC and got 2 years, $6 million from Winnipeg going into the 2016-17 season. Trouba was also playing more minutes - 6 minutes more per game - and had produced less on offense, but he only had Byfuglien and a then-good Myers ahead of him; it clearly dropped off after that. After that, the next best without having to go back 7+ years is Nathan Beaulieu, who got 2 years, $4.8 million from Buffalo for about the same ice time and less offense - all with Montreal. Otherwise, you have to go back 10 years to Matt Niskanen (2 years, $3 million from Dallas) and again, Niskanen was logging more ice time with less offense - but Niskanen was on a clearly inferior defense still leaning on Sergei Zubov and Philippe Boucher.
If you're Dunn, you can probably make the argument that because of the quality of defense on the team he's not having to log comparable ice time but he could if needed. I would guess his fair market price is 2 years, $4 million. Maybe a little more. Yes, that's even with a flat cap and all that.
Of course he would be, and IMO he'd be nuts to sign for that. I think he sits without a contract until right on the doorstep of training camp opening, whenever that is.