getInt method
Loads the value of a property as an integer given its key
.
Use defval
to set a default value in case of missing property.
Use defkey
to set a default key in case of missing property.
Implementation
int? getInt(
String key, {
bool throwException = false,
int? defval,
String? defkey,
}) {
var value = get(key, defval: defval, defkey: defkey);
if (value == null) {
return null;
}
try {
return int.parse(value);
} on FormatException catch (e) {
if (throwException) {
throw e;
}
return null;
}
}