Actually, I don't know why I didn't put this generally useful function into utils.dart. Fixed that.