createQueryUri static method

Uri createQueryUri(
  1. String query
)

Returns a Uri that can be launched on the current platform to open a maps application showing the result of a search query.

Implementation

static Uri createQueryUri(String query) {
  Uri uri;

  if (kIsWeb) {
    uri = Uri.https(
        'www.google.com', '/maps/search/', {'api': '1', 'query': query});
  } else if (Platform.isAndroid) {
    uri = Uri(scheme: 'geo', host: '0,0', queryParameters: {'q': query});
  } else if (Platform.isIOS) {
    uri = Uri.https('maps.apple.com', '/', {'q': query});
  } else {
    uri = Uri.https(
        'www.google.com', '/maps/search/', {'api': '1', 'query': query});
  }

  return uri;
}