getBestInitialSupplier static method

LocationListSupplier getBestInitialSupplier(
  1. String query
)

Implementation

static LocationListSupplier getBestInitialSupplier(String query) {
  int? osmId = int.tryParse(query);
  if (osmId != null) {
    final List<String> queries = <String>[];
    for (final LocationOSMType type in LocationOSMType.values) {
      queries.add('${type.short}$osmId');
    }
    return LocationListNominatimSupplier(queries);
  }
  if (query.length > 1) {
    final String firstChar = query.substring(0, 1).toUpperCase();
    for (final LocationOSMType type in LocationOSMType.values) {
      if (firstChar == type.short) {
        osmId = int.tryParse(query.substring(1));
        if (osmId != null) {
          return LocationListNominatimSupplier(<String>[query]);
        }
      }
    }
  }
  return LocationListPhotonSupplier(query, true);
}