launchURL method Null safety
ifOFF true adds the users country code in front of the url Throws a error when already populated YES https:// openfoodfacts.org/... NO https://de.openfoodfacts.org/...
Implementation
static Future<void> launchURL(String url, bool isOFF) async {
if (isOFF) {
url = _replaceSubdomainWithCodes(url);
}
AnalyticsHelper.trackOpenLink(url: url);
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
throw 'Could not launch $url';
}
}