search method
Finds the GeoLocationNode (City, or Region) with a name containing the value
Returns: A combination pf City, Region, where the name matches value
, as GeoLocationNode
Implementation
Iterable<GeoLocationNode> search(String value) {
var loweredName = name.toLowerCase();
var valueLowered = value.toLowerCase();
return [
...states.where((s) => "$loweredName, ${s.name.toLowerCase()}"
.toLowerCase()
.contains(valueLowered)),
...states
.map((s) => s.search(valueLowered, prefix: loweredName))
.expand((v) => v)
];
}