agecheck function
Implementation
bool agecheck(int age, String country) {
if (country.length != 2) {
print(
'[AgeCheck] The country code you inserted is too long or malformed',
);
return false;
} // Ensure country code is two characters long
if (!countries.containsKey(country)) {
print(
"[WARN] User's country is not in our database, but user is over 13. Proceed with caution as laws may apply that we are not aware of.",
);
} // Warn if country code is not in database
var countryAge = countries[country] ?? 13;
if (age >= countryAge) {
return true;
} else {
return false;
}
}