15 lines
394 B
Dart
15 lines
394 B
Dart
Uri? buildLauncherNewsUri(String rawBaseUrl, int newsId) {
|
|
final normalizedBaseUrl = rawBaseUrl.trim();
|
|
final baseUri = Uri.tryParse(
|
|
normalizedBaseUrl.endsWith('/') ? normalizedBaseUrl : '$normalizedBaseUrl/',
|
|
);
|
|
if (baseUri == null ||
|
|
!baseUri.hasScheme ||
|
|
baseUri.host.isEmpty ||
|
|
newsId <= 0) {
|
|
return null;
|
|
}
|
|
|
|
return baseUri.resolve('news/$newsId');
|
|
}
|