lookupURLById method

String? lookupURLById(
  1. String id, {
  2. String? country = 'US',
  3. String? language = 'en',
  4. bool useCacheBuster = true,
})

Create a URL that points to the Play Store details for an app.

Implementation

String? lookupURLById(String id,
    {String? country = 'US',
    String? language = 'en',
    bool useCacheBuster = true}) {
  assert(id.isNotEmpty);
  if (id.isEmpty) return null;

  Map<String, dynamic> parameters = {'id': id};
  if (country != null && country.isNotEmpty) {
    parameters['gl'] = country;
  }
  if (language != null && language.isNotEmpty) {
    parameters['hl'] = language;
  }
  if (useCacheBuster) {
    parameters['_cb'] = DateTime.now().microsecondsSinceEpoch.toString();
  }
  final url = Uri.https(playStorePrefixURL, '/store/apps/details', parameters)
      .toString();

  return url;
}