lundi 29 juillet 2019

dart alternate for a lot of if elseiif

I want to replace an URL String in Dart with another String. Example:

if (url == "http://www.example.com/1") {
home = "example";
} else if (url == "http://www.example.com/1") {
home = "another example";
}

Isn't there a better way with less code and maybe faster? I'd have to do this over 60 times..

Aucun commentaire:

Enregistrer un commentaire