lookupURLById method
Generates a URL that points to the Play Store details for an app.
Returns a URL string.
Implementation
String? lookupURLById(String id,
{String? country = 'US',
String? language = 'en'}) {
// Ensure the ID is not empty.
assert(id.isNotEmpty);
if (id.isEmpty) return null;
// Create a map of query parameters.
Map<String, dynamic> parameters = {'id': id};
if (country != null && country.isNotEmpty) {
parameters['gl'] = country;
}
if (language != null && language.isNotEmpty) {
parameters['hl'] = language;
}
parameters['_cb'] = DateTime.now().microsecondsSinceEpoch.toString();
// Generate the URL using the query parameters.
final url = Uri.https(playStorePrefixURL, '/store/apps/details', parameters)
.toString();
return url;
}