major update

This commit is contained in:
Fabian Freund
2025-03-03 15:15:05 +01:00
parent 200c82a442
commit 20bdc4df3e
103 changed files with 2664 additions and 783 deletions
+30
View File
@@ -0,0 +1,30 @@
import 'package:lensai/extensions/nullable.dart';
import 'package:lensai/utils/uri_parser.dart' as uri_parser;
String? validateUrl(
String? value, {
bool requireAuthority = true,
bool eagerParsing = true,
bool onlyHttpProtocol = false,
bool required = true,
}) {
if (value.isEmpty) {
if (required) {
return 'URL must be provided';
} else {
return null;
}
}
if (uri_parser.tryParseUrl(value, eagerParsing: eagerParsing)
case final Uri url) {
if (!requireAuthority || url.authority.isNotEmpty) {
if (!onlyHttpProtocol ||
(url.isScheme('https') || url.isScheme('http'))) {
return null;
}
}
}
return 'Inavlid URL';
}
+4
View File
@@ -23,6 +23,10 @@ class LRUCache<K, V> {
_capacity = capacity;
}
bool contains(K key) {
return _cache.containsKey(key);
}
V? get(K key) {
final value = _cache.remove(key); // Temporarily remove the item.