support nullable uri

This commit is contained in:
Fabian Freund
2025-06-29 20:10:11 +02:00
parent 9a1f36a029
commit 920c237112
5 changed files with 43 additions and 40 deletions
+14
View File
@@ -14,3 +14,17 @@ class UriConverter extends TypeConverter<Uri, String> {
return value.toString();
}
}
class UriConverterNullable extends TypeConverter<Uri?, String?> {
const UriConverterNullable();
@override
Uri? fromSql(String? fromDb) {
return uri_parser.tryParseUrl(fromDb, eagerParsing: true);
}
@override
String? toSql(Uri? value) {
return value?.toString();
}
}