validateConfig method
void
validateConfig()
This is a runtime safety check to ensure that the config looks valid Additional checks can be added here (e.g. regex, length checks, etc)
Implementation
void validateConfig() => config.forEach((element) {
if (!(element["route"] is String)) {
throw Exception("route must be a String");
}
if (!(element["label"] is String)) {
throw Exception("label must be a String");
}
if (element["color"] != null && !(element["color"] is Color)) {
throw Exception("color must be a Color");
}
if (!(element["icon"] is IconData)) {
throw Exception("icon must be IconData");
}
if (!(element["decorate"] is bool) && element["decorate"] != null) {
throw Exception("icon must be IconData");
}
});