Value keyToValue(String key) { for (var range in this) { if (range.regex.hasMatch(key)) { return Value(key, range.id); } } throw "Wrong data $key"; }