refactor: Make Uri extension null safe

This commit is contained in:
Christian Pauly 2021-09-07 14:47:12 +02:00 committed by Krille Fear
parent 92755c07d3
commit 5b13e0442e
1 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,3 @@
// @dart=2.9
/* /*
* Famedly Matrix SDK * Famedly Matrix SDK
* Copyright (C) 2019, 2020, 2021 Famedly GmbH * Copyright (C) 2019, 2020, 2021 Famedly GmbH
@ -35,10 +34,10 @@ extension MxcUriExtension on Uri {
/// If `animated` (default false) is set to true, an animated thumbnail is requested /// If `animated` (default false) is set to true, an animated thumbnail is requested
/// as per MSC2705. Thumbnails only animate if the media repository supports that. /// as per MSC2705. Thumbnails only animate if the media repository supports that.
Uri getThumbnail(Client matrix, Uri getThumbnail(Client matrix,
{num width, {num? width,
num height, num? height,
ThumbnailMethod method = ThumbnailMethod.crop, ThumbnailMethod? method = ThumbnailMethod.crop,
bool animated = false}) { bool? animated = false}) {
if (!isScheme('mxc')) return this; if (!isScheme('mxc')) return this;
if (matrix.homeserver == null) { if (matrix.homeserver == null) {
return Uri(); return Uri();