Browse Source

Merge pull request #394 from Leptopoda/cleanup/collection

neon: make use of collection in find extensions
pull/398/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
8da7ce8bfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/neon/neon/lib/neon.dart
  2. 11
      packages/neon/neon/lib/src/models/account.dart
  3. 10
      packages/neon/neon/lib/src/utils/app_implementation.dart

1
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';

11
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> {
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);
}

10
packages/neon/neon/lib/src/utils/app_implementation.dart

@ -74,13 +74,5 @@ abstract class AppImplementation<T extends Bloc, R extends NextcloudAppSpecificO
}
extension AppImplementationFind on Iterable<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);
}

Loading…
Cancel
Save