From 68a479041a8d1c3dfbc135328d13964384da3b6b Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Fri, 29 Sep 2023 08:18:25 +0200 Subject: [PATCH] perf(nextcloud): improve notes version supported performance Signed-off-by: Nikolas Rimikis --- packages/nextcloud/lib/src/version_supported.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nextcloud/lib/src/version_supported.dart b/packages/nextcloud/lib/src/version_supported.dart index 61008f20..7ef7e169 100644 --- a/packages/nextcloud/lib/src/version_supported.dart +++ b/packages/nextcloud/lib/src/version_supported.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import 'package:nextcloud/src/api/core.openapi.dart'; import 'package:nextcloud/src/api/news.openapi.dart'; import 'package:nextcloud/src/api/notes.openapi.dart'; @@ -51,9 +52,8 @@ extension NotesVersionSupported on NotesClient { (bool, int) isSupported(final CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data capabilities) => ( capabilities.capabilities.notesCapabilities?.notes.apiVersion ?.map(Version.parse) - .where((final version) => version.major == notesSupportedVersion) - .isNotEmpty ?? - false, + .firstWhereOrNull((final version) => version.major == notesSupportedVersion) != + null, notesSupportedVersion, ); }