diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index a2093959..8f4ea9ff 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -6,6 +6,7 @@ import 'dart:io'; import 'dart:ui'; import 'package:bitmap/bitmap.dart'; +import 'package:collection/collection.dart'; import 'package:crypto/crypto.dart'; import 'package:file_picker/file_picker.dart'; import 'package:filesize/filesize.dart'; diff --git a/packages/neon/neon/lib/src/models/account.dart b/packages/neon/neon/lib/src/models/account.dart index 999e7710..78bdf0d7 100644 --- a/packages/neon/neon/lib/src/models/account.dart +++ b/packages/neon/neon/lib/src/models/account.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:collection/collection.dart'; import 'package:crypto/crypto.dart'; import 'package:flutter/foundation.dart'; import 'package:json_annotation/json_annotation.dart'; @@ -104,13 +105,5 @@ extension NextcloudClientHelpers on NextcloudClient { } extension AccountFind on Iterable { - Account? find(final String accountID) { - for (final account in this) { - if (account.id == accountID) { - return account; - } - } - - return null; - } + Account? find(final String accountID) => firstWhereOrNull((final account) => account.id == accountID); } diff --git a/packages/neon/neon/lib/src/utils/app_implementation.dart b/packages/neon/neon/lib/src/utils/app_implementation.dart index 9456afb3..9baced14 100644 --- a/packages/neon/neon/lib/src/utils/app_implementation.dart +++ b/packages/neon/neon/lib/src/utils/app_implementation.dart @@ -74,13 +74,5 @@ abstract class AppImplementation { - AppImplementation? find(final String appID) { - for (final app in this) { - if (app.id == appID) { - return app; - } - } - - return null; - } + AppImplementation? find(final String appID) => firstWhereOrNull((final app) => app.id == appID); }