Checks if a number n is a perfect square.
n
static bool isPerfectSquare(int n) { final sqrtN = math.sqrt(n).toInt(); return sqrtN * sqrtN == n; }