Skip to content

High performance self-hosted photo and video management solution.

chore(mobile): Apply stricter linting rules for formatting (#30370)

Adam Gastineaud864a9081173
diff --git a/mobile/analysis_options.yaml b/mobile/analysis_options.yaml
index f5ead8de2e..1a7b463913 100644
--- a/mobile/analysis_options.yaml
+++ b/mobile/analysis_options.yaml
@@ -26,8 +26,8 @@ linter:
# producing the lint.
rules:
- # avoid_print: false # Uncomment to disable the `avoid_print` rule
- # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
+ # Formatting
+ avoid_print: true
unawaited_futures: true
use_build_context_synchronously: false
require_trailing_commas: true
@@ -35,6 +35,21 @@ linter:
prefer_const_constructors: true
always_use_package_imports: true
always_put_control_body_on_new_line: true
+ unnecessary_null_checks: true
+ unnecessary_parenthesis: true
+ prefer_final_locals: true
+ prefer_const_declarations: true
+ prefer_const_literals_to_create_immutables: true
+ use_super_parameters: true
+ directives_ordering: true
+ no_leading_underscores_for_local_identifiers: true
+ always_declare_return_types: true
+ avoid_void_async: true
+ noop_primitive_operations: true
+ use_named_constants: true
+ combinators_ordering: true
+ avoid_multiple_declarations_per_line: true
+ unnecessary_breaks: true
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
@@ -46,20 +61,12 @@ analyzer:
- lib/**/*.g.dart
- lib/**/*.drift.dart
- # TODO: Re-enable after upgrading custom_lint
- # plugins:
- # - custom_lint
+ # NOTE: We explicitly do not use riverpod_lint as there are analyzer version conflicts between
+ # our Flutter version and the required old riverpod_lint 2.x
errors:
unawaited_futures: warning
always_put_control_body_on_new_line: warning
-custom_lint:
- rules:
- - avoid_build_context_in_providers: false
- - avoid_public_notifier_properties: false
- - avoid_manual_providers_as_generated_provider_dependency: false
- - unsupported_provider_value: false
-
dart_code_metrics:
rules:
- banned-usage:
diff --git a/mobile/lib/constants/aspect_ratios.dart b/mobile/lib/constants/aspect_ratios.dart
index 7a1f46d198..9ad7b8c739 100644
--- a/mobile/lib/constants/aspect_ratios.dart
+++ b/mobile/lib/constants/aspect_ratios.dart
@@ -42,8 +42,8 @@ class CropAspectRatio {
}
}
-const aspectRatioFree = CropAspectRatio(customLabel: "Free", icon: Icons.crop_free);
-const aspectRatioOriginal = CropAspectRatio(customLabel: "Original", icon: Icons.crop_original);
+const aspectRatioFree = CropAspectRatio.free;
+const aspectRatioOriginal = CropAspectRatio.original;
final aspectRatioPresets = [
CropAspectRatio.free,
diff --git a/mobile/lib/domain/models/asset/base_asset.model.dart b/mobile/lib/domain/models/asset/base_asset.model.dart
index ea6f0ab287..d7d74daa25 100644
--- a/mobile/lib/domain/models/asset/base_asset.model.dart
+++ b/mobile/lib/domain/models/asset/base_asset.model.dart
@@ -53,7 +53,7 @@ sealed class BaseAsset {
if (durationMs != null) {
return Duration(milliseconds: durationMs);
}
- return const Duration();
+ return Duration.zero;
}
bool get hasRemote => storage == AssetState.remote || storage == AssetState.merged;
diff --git a/mobile/lib/domain/models/asset_edit.model.dart b/mobile/lib/domain/models/asset_edit.model.dart
index 9809b9c606..c7a09dbae3 100644
--- a/mobile/lib/domain/models/asset_edit.model.dart
+++ b/mobile/lib/domain/models/asset_edit.model.dart
@@ -1,4 +1,4 @@
-import "package:openapi/api.dart" show CropParameters, RotateParameters, MirrorParameters;
+import "package:openapi/api.dart" show CropParameters, MirrorParameters, RotateParameters;
enum AssetEditAction { rotate, crop, mirror, other }
diff --git a/mobile/lib/domain/models/config/app_config.dart b/mobile/lib/domain/models/config/app_config.dart
index e4e11baf9d..df147f3e3a 100644
--- a/mobile/lib/domain/models/config/app_config.dart
+++ b/mobile/lib/domain/models/config/app_config.dart
@@ -190,9 +190,9 @@ class AppConfig {
.viewerTapToNavigate => copyWith(viewer: viewer.copyWith(tapToNavigate: value as bool)),
.networkAutoEndpointSwitching => copyWith(network: network.copyWith(autoEndpointSwitching: value as bool)),
.networkPreferredWifiName => copyWith(
- network: network.copyWith(preferredWifiName: .fromNullable((value as String?))),
+ network: network.copyWith(preferredWifiName: .fromNullable(value as String?)),
),
- .networkLocalEndpoint => copyWith(network: network.copyWith(localEndpoint: .fromNullable((value as String?)))),
+ .networkLocalEndpoint => copyWith(network: network.copyWith(localEndpoint: .fromNullable(value as String?))),
.networkExternalEndpointList => copyWith(network: network.copyWith(externalEndpointList: value as List<String>)),
.networkCustomHeaders => copyWith(network: network.copyWith(customHeaders: value as Map<String, String>)),
.albumSortMode => copyWith(album: album.copyWith(sortMode: value as AlbumSortMode)),
diff --git a/mobile/lib/domain/services/remote_album.service.dart b/mobile/lib/domain/services/remote_album.service.dart
index c0bbaa8127..e59d75b01a 100644
--- a/mobile/lib/domain/services/remote_album.service.dart
+++ b/mobile/lib/domain/services/remote_album.service.dart
@@ -105,10 +105,8 @@ class RemoteAlbumService {
switch (filterMode) {
case QuickFilterMode.myAlbums:
filtered = filtered.where((album) => album.ownerId == userId).toList();
- break;
case QuickFilterMode.sharedWithMe:
filtered = filtered.where((album) => album.ownerId != userId).toList();
- break;
case QuickFilterMode.all:
break;
}
diff --git a/mobile/lib/domain/services/sync_stream.service.dart b/mobile/lib/domain/services/sync_stream.service.dart
index 9ebce300ba..9b4d4bb275 100644
--- a/mobile/lib/domain/services/sync_stream.service.dart
+++ b/mobile/lib/domain/services/sync_stream.service.dart
@@ -155,7 +155,7 @@ class SyncStreamService {
}
Future<void> _handleEvents(List<SyncEvent> events, Function() abort, Function() reset) async {
- List<SyncEvent> items = [];
+ final List<SyncEvent> items = [];
for (final event in events) {
if (isCancelled) {
_logger.warning("Sync stream cancelled");
diff --git a/mobile/lib/domain/services/timeline.service.dart b/mobile/lib/domain/services/timeline.service.dart
index 4cc58b0fe7..9b539ec218 100644
--- a/mobile/lib/domain/services/timeline.service.dart
+++ b/mobile/lib/domain/services/timeline.service.dart
@@ -178,7 +178,7 @@ class TimelineService {
if (!hasRange(index, count)) {
throw RangeError('TimelineService::getAssets Index out of range');
}
- int start = index - _bufferOffset;
+ final int start = index - _bufferOffset;
return _buffer.slice(start, start + count);
}
diff --git a/mobile/lib/extensions/asset_extensions.dart b/mobile/lib/extensions/asset_extensions.dart
index 52d31cb0b3..ec1aa80ceb 100644
--- a/mobile/lib/extensions/asset_extensions.dart
+++ b/mobile/lib/extensions/asset_extensions.dart
@@ -15,8 +15,8 @@ extension DTOToAsset on api.AssetResponseDto {
ownerId: ownerId,
visibility: visibility.toAssetVisibility(),
durationMs: duration,
- height: height?.toInt(),
- width: width?.toInt(),
+ height: height,
+ width: width,
isFavorite: isFavorite,
livePhotoVideoId: livePhotoVideoId.orElse(null),
thumbHash: thumbhash,
@@ -38,8 +38,8 @@ extension DTOToAsset on api.AssetResponseDto {
ownerId: ownerId,
visibility: visibility.toAssetVisibility(),
durationMs: duration,
- height: height?.toInt(),
- width: width?.toInt(),
+ height: height,
+ width: width,
isFavorite: isFavorite,
livePhotoVideoId: livePhotoVideoId.orElse(null),
thumbHash: thumbhash,
diff --git a/mobile/lib/extensions/collection_extensions.dart b/mobile/lib/extensions/collection_extensions.dart
index b861eb0570..53e8e73fd1 100644
--- a/mobile/lib/extensions/collection_extensions.dart
+++ b/mobile/lib/extensions/collection_extensions.dart
@@ -5,7 +5,8 @@ import 'package:collection/collection.dart';
extension ListExtension<E> on List<E> {
List<E> uniqueConsecutive({int Function(E a, E b)? compare, void Function(E a, E b)? onDuplicate}) {
compare ??= (E a, E b) => a == b ? 0 : 1;
- int i = 1, j = 1;
+ int i = 1;
+ int j = 1;
for (; i < length; i++) {
if (compare(this[i - 1], this[i]) != 0) {
if (i != j) {
diff --git a/mobile/lib/extensions/datetime_extensions.dart b/mobile/lib/extensions/datetime_extensions.dart
index 0bc95565a6..6a51d15df0 100644
--- a/mobile/lib/extensions/datetime_extensions.dart
+++ b/mobile/lib/extensions/datetime_extensions.dart
@@ -4,7 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
extension TimeAgoExtension on DateTime {
/// Displays the time difference of this [DateTime] object to the current time as a [String]
String timeAgo({bool numericDates = true}) {
- DateTime date = toLocal();
+ final DateTime date = toLocal();
final now = DateTime.now().toLocal();
final difference = now.difference(date);
@@ -13,27 +13,27 @@ extension TimeAgoExtension on DateTime {
} else if (difference.inSeconds < 60) {
return '${difference.inSeconds} seconds ago';
} else if (difference.inMinutes <= 1) {
- return (numericDates) ? '1 minute ago' : 'A minute ago';
+ return numericDates ? '1 minute ago' : 'A minute ago';
} else if (difference.inMinutes < 60) {
return '${difference.inMinutes} minutes ago';
} else if (difference.inHours <= 1) {
- return (numericDates) ? '1 hour ago' : 'An hour ago';
+ return numericDates ? '1 hour ago' : 'An hour ago';
} else if (difference.inHours < 60) {
return '${difference.inHours} hours ago';
} else if (difference.inDays <= 1) {
- return (numericDates) ? '1 day ago' : 'Yesterday';
+ return numericDates ? '1 day ago' : 'Yesterday';
} else if (difference.inDays < 6) {
return '${difference.inDays} days ago';
} else if ((difference.inDays / 7).ceil() <= 1) {
- return (numericDates) ? '1 week ago' : 'Last week';
+ return numericDates ? '1 week ago' : 'Last week';
} else if ((difference.inDays / 7).ceil() < 4) {
return '${(difference.inDays / 7).ceil()} weeks ago';
} else if ((difference.inDays / 30).ceil() <= 1) {
- return (numericDates) ? '1 month ago' : 'Last month';
+ return numericDates ? '1 month ago' : 'Last month';
} else if ((difference.inDays / 30).ceil() < 30) {
return '${(difference.inDays / 30).ceil()} months ago';
} else if ((difference.inDays / 365).ceil() <= 1) {
- return (numericDates) ? '1 year ago' : 'Last year';
+ return numericDates ? '1 year ago' : 'Last year';
}
return '${(difference.inDays / 365).floor()} years ago';
}
diff --git a/mobile/lib/infrastructure/entities/exif.entity.dart b/mobile/lib/infrastructure/entities/exif.entity.dart
index 120fbd0c68..3328b38f31 100644
--- a/mobile/lib/infrastructure/entities/exif.entity.dart
+++ b/mobile/lib/infrastructure/entities/exif.entity.dart
@@ -79,8 +79,8 @@ extension RemoteExifEntityDataDomainEx on RemoteExifEntityData {
orientation: orientation,
latitude: latitude,
longitude: longitude,
- f: fNumber?.toDouble(),
- mm: focalLength?.toDouble(),
+ f: fNumber,
+ mm: focalLength,
lens: lens,
isFlipped: ExifDtoConverter.isOrientationFlipped(orientation),
exposureSeconds: ExifDtoConverter.exposureTimeToSeconds(exposureTime),
diff --git a/mobile/lib/infrastructure/entities/log.entity.dart b/mobile/lib/infrastructure/entities/log.entity.dart
index e578459827..264bd3331f 100644
--- a/mobile/lib/infrastructure/entities/log.entity.dart
+++ b/mobile/lib/infrastructure/entities/log.entity.dart
@@ -1,6 +1,6 @@
import 'package:drift/drift.dart';
-import 'package:immich_mobile/infrastructure/entities/log.entity.drift.dart';
import 'package:immich_mobile/domain/models/log.model.dart' as domain;
+import 'package:immich_mobile/infrastructure/entities/log.entity.drift.dart';
class LogMessageEntity extends Table {
const LogMessageEntity();
diff --git a/mobile/lib/infrastructure/loaders/image_request.dart b/mobile/lib/infrastructure/loaders/image_request.dart
index d0f3679084..8b7cdc7621 100644
--- a/mobile/lib/infrastructure/loaders/image_request.dart
+++ b/mobile/lib/infrastructure/loaders/image_request.dart
@@ -18,7 +18,7 @@ abstract class ImageRequest {
final int requestId = _nextRequestId++;
bool _isCancelled = false;
- get isCancelled => _isCancelled;
+ bool get isCancelled => _isCancelled;
ImageRequest();
diff --git a/mobile/lib/infrastructure/loaders/remote_image_request.dart b/mobile/lib/infrastructure/loaders/remote_image_request.dart
index 40705c16d2..d6a25753fb 100644
--- a/mobile/lib/infrastructure/loaders/remote_image_request.dart
+++ b/mobile/lib/infrastructure/loaders/remote_image_request.dart
@@ -14,8 +14,13 @@ class RemoteImageRequest extends ImageRequest {
final info = await remoteImageApi.requestImage(uri, requestId: requestId, preferEncoded: false);
// Android falls back to encoded data if native decoding fails, so check for both shapes of the response.
final frame = switch (info) {
- {'pointer': int pointer, 'length': int length} => await _fromEncodedPlatformImage(pointer, length),
- {'pointer': int pointer, 'width': int width, 'height': int height, 'rowBytes': int rowBytes} =>
+ {'pointer': final int pointer, 'length': final int length} => await _fromEncodedPlatformImage(pointer, length),
+ {
+ 'pointer': final int pointer,
+ 'width': final int width,
+ 'height': final int height,
+ 'rowBytes': final int rowBytes,
+ } =>
await _fromDecodedPlatformImage(pointer, width, height, rowBytes),
_ => null,
};
diff --git a/mobile/lib/infrastructure/repositories/backup.repository.dart b/mobile/lib/infrastructure/repositories/backup.repository.dart
index 0241711d4b..eb3cba95d0 100644
--- a/mobile/lib/infrastructure/repositories/backup.repository.dart
+++ b/mobile/lib/infrastructure/repositories/backup.repository.dart
@@ -4,6 +4,7 @@ import 'package:drift/drift.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
+import 'package:immich_mobile/infrastructure/entities/local_album_asset.entity.drift.dart';
import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
@@ -16,7 +17,7 @@ class DriftBackupRepository extends DriftDatabaseRepository {
final Drift _db;
const DriftBackupRepository(this._db) : super(_db);
- _getExcludedSubquery() {
+ JoinedSelectStatement<$LocalAlbumAssetEntityTable, LocalAlbumAssetEntityData> _getExcludedSubquery() {
return _db.localAlbumAssetEntity.selectOnly()
..addColumns([_db.localAlbumAssetEntity.assetId])
..join([
diff --git a/mobile/lib/infrastructure/repositories/local_album.repository.dart b/mobile/lib/infrastructure/repositories/local_album.repository.dart
index a443ffb975..a9911fe044 100644
--- a/mobile/lib/infrastructure/repositories/local_album.repository.dart
+++ b/mobile/lib/infrastructure/repositories/local_album.repository.dart
@@ -356,7 +356,7 @@ class DriftLocalAlbumRepository extends DriftDatabaseRepository {
return _deleteAssets(assetIds);
}
- List<String> assetsToDelete = [];
+ final List<String> assetsToDelete = [];
List<String> assetsToUnLink = [];
final uniqueAssets = await _getUniqueAssetsInAlbum(albumId);
diff --git a/mobile/lib/infrastructure/repositories/ocr.repository.dart b/mobile/lib/infrastructure/repositories/ocr.repository.dart
index 99f4fa4675..c3465df357 100644
--- a/mobile/lib/infrastructure/repositories/ocr.repository.dart
+++ b/mobile/lib/infrastructure/repositories/ocr.repository.dart
@@ -1,7 +1,7 @@
+import 'package:drift/drift.dart';
import 'package:immich_mobile/domain/models/ocr.model.dart';
import 'package:immich_mobile/infrastructure/entities/asset_ocr.entity.drift.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
-import 'package:drift/drift.dart';
class OcrRepository extends DriftDatabaseRepository {
final Drift _db;
diff --git a/mobile/lib/infrastructure/repositories/search_api.repository.dart b/mobile/lib/infrastructure/repositories/search_api.repository.dart
index 395d4045cf..dec6e1d167 100644
--- a/mobile/lib/infrastructure/repositories/search_api.repository.dart
+++ b/mobile/lib/infrastructure/repositories/search_api.repository.dart
@@ -21,28 +21,28 @@ class SearchApiRepository extends ApiRepository {
(filter.assetId != null && filter.assetId!.isNotEmpty)) {
return _api.searchSmart(
SmartSearchDto(
- query: filter.context == null ? const Optional.absent() : Optional.present(filter.context!),
- queryAssetId: filter.assetId == null ? const Optional.absent() : Optional.present(filter.assetId!),
- language: filter.language == null ? const Optional.absent() : Optional.present(filter.language!),
+ query: filter.context == null ? const Optional.absent() : Optional.present(filter.context),
+ queryAssetId: filter.assetId == null ? const Optional.absent() : Optional.present(filter.assetId),
+ language: filter.language == null ? const Optional.absent() : Optional.present(filter.language),
country: filter.location.country == null
? const Optional.absent()
- : Optional.present(filter.location.country!),
- state: filter.location.state == null ? const Optional.absent() : Optional.present(filter.location.state!),
- city: filter.location.city == null ? const Optional.absent() : Optional.present(filter.location.city!),
- make: filter.camera.make == null ? const Optional.absent() : Optional.present(filter.camera.make!),
- model: filter.camera.model == null ? const Optional.absent() : Optional.present(filter.camera.model!),
+ : Optional.present(filter.location.country),
+ state: filter.location.state == null ? const Optional.absent() : Optional.present(filter.location.state),
+ city: filter.location.city == null ? const Optional.absent() : Optional.present(filter.location.city),
+ make: filter.camera.make == null ? const Optional.absent() : Optional.present(filter.camera.make),
+ model: filter.camera.model == null ? const Optional.absent() : Optional.present(filter.camera.model),
takenAfter: filter.date.takenAfter == null
? const Optional.absent()
- : Optional.present(filter.date.takenAfter!),
+ : Optional.present(filter.date.takenAfter),
takenBefore: filter.date.takenBefore == null
? const Optional.absent()
- : Optional.present(filter.date.takenBefore!),
+ : Optional.present(filter.date.takenBefore),
visibility: Optional.present(filter.display.isArchive ? AssetVisibility.archive : AssetVisibility.timeline),
rating: filter.rating.rating.toOptional(),
isFavorite: filter.display.isFavorite ? const Optional.present(true) : const Optional.absent(),
isNotInAlbum: filter.display.isNotInAlbum ? const Optional.present(true) : const Optional.absent(),
personIds: Optional.present(filter.people.map((e) => e.id).toList()),
- tagIds: filter.tagIds == null ? const Optional.absent() : Optional.present(filter.tagIds!),
+ tagIds: filter.tagIds == null ? const Optional.absent() : Optional.present(filter.tagIds),
type: type == null ? const Optional.absent() : Optional.present(type),
page: Optional.present(page),
size: const Optional.present(100),
@@ -53,29 +53,27 @@ class SearchApiRepository extends ApiRepository {
return _api.searchAssets(
MetadataSearchDto(
originalFileName: filter.filename != null && filter.filename!.isNotEmpty
- ? Optional.present(filter.filename!)
+ ? Optional.present(filter.filename)
: const Optional.absent(),
- country: filter.location.country == null ? const Optional.absent() : Optional.present(filter.location.country!),
+ country: filter.location.country == null ? const Optional.absent() : Optional.present(filter.location.country),
description: filter.description != null && filter.description!.isNotEmpty
- ? Optional.present(filter.description!)
+ ? Optional.present(filter.description)
: const Optional.absent(),
- ocr: filter.ocr != null && filter.ocr!.isNotEmpty ? Optional.present(filter.ocr!) : const Optional.absent(),
- state: filter.location.state == null ? const Optional.absent() : Optional.present(filter.location.state!),
- city: filter.location.city == null ? const Optional.absent() : Optional.present(filter.location.city!),
- make: filter.camera.make == null ? const Optional.absent() : Optional.present(filter.camera.make!),
- model: filter.camera.model == null ? const Optional.absent() : Optional.present(filter.camera.model!),
- takenAfter: filter.date.takenAfter == null
- ? const Optional.absent()
- : Optional.present(filter.date.takenAfter!),
+ ocr: filter.ocr != null && filter.ocr!.isNotEmpty ? Optional.present(filter.ocr) : const Optional.absent(),
+ state: filter.location.state == null ? const Optional.absent() : Optional.present(filter.location.state),
+ city: filter.location.city == null ? const Optional.absent() : Optional.present(filter.location.city),
+ make: filter.camera.make == null ? const Optional.absent() : Optional.present(filter.camera.make),
+ model: filter.camera.model == null ? const Optional.absent() : Optional.present(filter.camera.model),
+ takenAfter: filter.date.takenAfter == null ? const Optional.absent() : Optional.present(filter.date.takenAfter),
takenBefore: filter.date.takenBefore == null
? const Optional.absent()
- : Optional.present(filter.date.takenBefore!),
+ : Optional.present(filter.date.takenBefore),
visibility: Optional.present(filter.display.isArchive ? AssetVisibility.archive : AssetVisibility.timeline),
rating: filter.rating.rating.toOptional(),
isFavorite: filter.display.isFavorite ? const Optional.present(true) : const Optional.absent(),
isNotInAlbum: filter.display.isNotInAlbum ? const Optional.present(true) : const Optional.absent(),
personIds: Optional.present(filter.people.map((e) => e.id).toList()),
- tagIds: filter.tagIds == null ? const Optional.absent() : Optional.present(filter.tagIds!),
+ tagIds: filter.tagIds == null ? const Optional.absent() : Optional.present(filter.tagIds),
type: type == null ? const Optional.absent() : Optional.present(type),
page: Optional.present(page),
size: const Optional.present(1000),
diff --git a/mobile/lib/infrastructure/repositories/sync_api.repository.dart b/mobile/lib/infrastructure/repositories/sync_api.repository.dart
index e9d57f7506..303859da2f 100644
--- a/mobile/lib/infrastructure/repositories/sync_api.repository.dart
+++ b/mobile/lib/infrastructure/repositories/sync_api.repository.dart
@@ -80,7 +80,7 @@ class SyncApiRepository {
);
String previousChunk = '';
- List<String> lines = [];
+ final List<String> lines = [];
bool shouldAbort = false;
@@ -105,7 +105,7 @@ class SyncApiRepository {
}
previousChunk += chunk;
- final parts = previousChunk.toString().split('\n');
+ final parts = previousChunk.split('\n');
previousChunk = parts.removeLast();
lines.addAll(parts);
diff --git a/mobile/lib/infrastructure/repositories/sync_stream.repository.dart b/mobile/lib/infrastructure/repositories/sync_stream.repository.dart
index bdfb1942ab..844226d49f 100644
--- a/mobile/lib/infrastructure/repositories/sync_stream.repository.dart
+++ b/mobile/lib/infrastructure/repositories/sync_stream.repository.dart
@@ -31,8 +31,8 @@ import 'package:immich_mobile/infrastructure/entities/user_metadata.entity.drift
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
import 'package:immich_mobile/infrastructure/utils/exif.converter.dart';
import 'package:logging/logging.dart';
-import 'package:openapi/api.dart' as api show AssetVisibility, AlbumUserRole, UserMetadataKey, AssetEditAction;
-import 'package:openapi/api.dart' hide UserMetadataKey, AssetEditAction, AssetVisibility, AlbumUserRole;
+import 'package:openapi/api.dart' as api show AlbumUserRole, AssetEditAction, AssetVisibility, UserMetadataKey;
+import 'package:openapi/api.dart' hide AlbumUserRole, AssetEditAction, AssetVisibility, UserMetadataKey;
class SyncStreamRepository extends DriftDatabaseRepository {
final Logger _logger = Logger('DriftSyncStreamRepository');
@@ -287,8 +287,8 @@ class SyncStreamRepository extends DriftDatabaseRepository {
fNumber: Value(exif.fNumber),
fileSize: Value(exif.fileSizeInByte),
focalLength: Value(exif.focalLength),
- latitude: Value(exif.latitude?.toDouble()),
- longitude: Value(exif.longitude?.toDouble()),
+ latitude: Value(exif.latitude),
+ longitude: Value(exif.longitude),
iso: Value(exif.iso),
make: Value(exif.make),
model: Value(exif.model),
diff --git a/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart b/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart
index 08712588d9..e31b47a9fc 100644
--- a/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart
+++ b/mobile/lib/infrastructure/repositories/trashed_local_asset.repository.dart
@@ -66,7 +66,7 @@ class DriftTrashedLocalAssetRepository extends DriftDatabaseRepository {
return;
}
final assetIds = trashedAssets.map((e) => e.asset.id).toSet();
- Map<String, String> localChecksumById = await _getCachedChecksums(assetIds);
+ final Map<String, String> localChecksumById = await _getCachedChecksums(assetIds);
return _db.transaction(() async {
await _db.batch((batch) {
diff --git a/mobile/lib/infrastructure/utils/exif.converter.dart b/mobile/lib/infrastructure/utils/exif.converter.dart
index 9f9b6f9324..d47c9cc97a 100644
--- a/mobile/lib/infrastructure/utils/exif.converter.dart
+++ b/mobile/lib/infrastructure/utils/exif.converter.dart
@@ -21,7 +21,7 @@ abstract final class ExifDtoConverter {
lens: dto.lensModel.orElse(null),
f: dto.fNumber.orElse(null)?.toDouble(),
mm: dto.focalLength.orElse(null)?.toDouble(),
- iso: dto.iso.orElse(null)?.toInt(),
+ iso: dto.iso.orElse(null),
exposureSeconds: exposureTimeToSeconds(dto.exposureTime.orElse(null)),
);
}
@@ -40,7 +40,7 @@ abstract final class ExifDtoConverter {
if (second == null) {
return null;
}
- double? value = double.tryParse(second);
+ final double? value = double.tryParse(second);
if (value != null) {
return value;
}
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart
index f576a7c63c..09bcdc752f 100644
--- a/mobile/lib/main.dart
+++ b/mobile/lib/main.dart
@@ -24,13 +24,13 @@ import 'package:immich_mobile/pages/common/splash_screen.page.dart';
import 'package:immich_mobile/platform/background_worker_lock_api.g.dart';
import 'package:immich_mobile/providers/app_life_cycle.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/share_intent_upload.provider.dart';
-import 'package:immich_mobile/providers/view_intent/view_intent_handler.provider.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
-import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/infrastructure/platform.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/locale_provider.dart';
import 'package:immich_mobile/providers/routes.provider.dart';
import 'package:immich_mobile/providers/theme.provider.dart';
+import 'package:immich_mobile/providers/view_intent/view_intent_handler.provider.dart';
import 'package:immich_mobile/routing/app_navigation_observer.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/services/deep_link.service.dart';
@@ -84,7 +84,7 @@ Future<void> initApp() async {
FlutterError.presentError(details);
log.severe(
'FlutterError - Catch all',
- "${details.toString()}\nException: ${details.exception}\nLibrary: ${details.library}\nContext: ${details.context}",
+ "$details\nException: ${details.exception}\nLibrary: ${details.library}\nContext: ${details.context}",
details.stack,
);
};
@@ -130,23 +130,18 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
dPrint(() => "[APP STATE] resumed");
ref.read(appStateProvider.notifier).handleAppResume();
unawaited(ref.read(viewIntentHandlerProvider).onAppResumed());
- break;
case AppLifecycleState.inactive:
dPrint(() => "[APP STATE] inactive");
ref.read(appStateProvider.notifier).handleAppInactivity();
- break;
case AppLifecycleState.paused:
dPrint(() => "[APP STATE] paused");
ref.read(appStateProvider.notifier).handleAppPause();
- break;
case AppLifecycleState.detached:
dPrint(() => "[APP STATE] detached");
ref.read(appStateProvider.notifier).handleAppDetached();
- break;
case AppLifecycleState.hidden:
dPrint(() => "[APP STATE] hidden");
ref.read(appStateProvider.notifier).handleAppHidden();
- break;
}
}
@@ -219,7 +214,7 @@ class ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserve
}
@override
- initState() {
+ void initState() {
super.initState();
initApp().then((_) => dPrint(() => "App Init Completed"));
WidgetsBinding.instance.addPostFrameCallback((_) {
diff --git a/mobile/lib/pages/backup/drift_backup.page.dart b/mobile/lib/pages/backup/drift_backup.page.dart
index 9e78fb4795..793437579a 100644
--- a/mobile/lib/pages/backup/drift_backup.page.dart
+++ b/mobile/lib/pages/backup/drift_backup.page.dart
@@ -67,7 +67,7 @@ class _DriftBackupPageState extends ConsumerState<DriftBackupPage> {
}
@override
- dispose() {
+ void dispose() {
super.dispose();
WakelockPlus.disable();
}
diff --git a/mobile/lib/pages/backup/drift_backup_album_selection.page.dart b/mobile/lib/pages/backup/drift_backup_album_selection.page.dart
index b0616589f1..9f60a4e193 100644
--- a/mobile/lib/pages/backup/drift_backup_album_selection.page.dart
+++ b/mobile/lib/pages/backup/drift_backup_album_selection.page.dart
@@ -12,8 +12,8 @@ import 'package:immich_mobile/infrastructure/repositories/settings.repository.da
import 'package:immich_mobile/providers/background_sync.provider.dart';
import 'package:immich_mobile/providers/backup/backup_album.provider.dart';
import 'package:immich_mobile/providers/backup/drift_backup.provider.dart';
-import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/infrastructure/platform.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
import 'package:immich_mobile/widgets/backup/drift_album_info_list_tile.dart';
import 'package:immich_mobile/widgets/common/search_field.dart';
@@ -321,9 +321,9 @@ class _AlbumSelectionList extends StatelessWidget {
return SliverPadding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
sliver: SliverList(
- delegate: SliverChildBuilderDelegate(((context, index) {
+ delegate: SliverChildBuilderDelegate((context, index) {
return DriftAlbumInfoListTile(album: filteredAlbums[index]);
- }), childCount: filteredAlbums.length),
+ }, childCount: filteredAlbums.length),
),
);
}
@@ -345,9 +345,9 @@ class _AlbumSelectionGrid extends StatelessWidget {
crossAxisSpacing: 12,
),
itemCount: filteredAlbums.length,
- itemBuilder: ((context, index) {
+ itemBuilder: (context, index) {
return DriftAlbumInfoListTile(album: filteredAlbums[index]);
- }),
+ },
),
);
}
diff --git a/mobile/lib/pages/backup/drift_backup_asset_detail.page.dart b/mobile/lib/pages/backup/drift_backup_asset_detail.page.dart
index 36d51c5624..b35abd198e 100644
--- a/mobile/lib/pages/backup/drift_backup_asset_detail.page.dart
+++ b/mobile/lib/pages/backup/drift_backup_asset_detail.page.dart
@@ -20,7 +20,7 @@ class DriftBackupAssetDetailPage extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
- AsyncValue<List<LocalAsset>> result = ref.watch(driftBackupCandidateProvider);
+ final AsyncValue<List<LocalAsset>> result = ref.watch(driftBackupCandidateProvider);
return Scaffold(
appBar: AppBar(title: Text('backup_controller_page_remainder'.t(context: context))),
body: result.when(
diff --git a/mobile/lib/pages/backup/drift_upload_detail.page.dart b/mobile/lib/pages/backup/drift_upload_detail.page.dart
index 978fcf7c57..3c2570a434 100644
--- a/mobile/lib/pages/backup/drift_upload_detail.page.dart
+++ b/mobile/lib/pages/backup/drift_upload_detail.page.dart
@@ -520,7 +520,7 @@ class _CurrentUploadThumbnail extends ConsumerWidget {
),
clipBehavior: Clip.antiAlias,
child: snapshot.data != null
- ? Thumbnail.fromAsset(asset: snapshot.data!, size: const Size(48, 48), fit: BoxFit.cover)
+ ? Thumbnail.fromAsset(asset: snapshot.data, size: const Size(48, 48), fit: BoxFit.cover)
: Icon(Icons.image, size: 24, color: context.colorScheme.primary),
),
);
diff --git a/mobile/lib/pages/common/app_log.page.dart b/mobile/lib/pages/common/app_log.page.dart
index 336bf0b605..5458d90808 100644
--- a/mobile/lib/pages/common/app_log.page.dart
+++ b/mobile/lib/pages/common/app_log.page.dart
@@ -90,7 +90,7 @@ class AppLogPage extends HookConsumerWidget {
},
itemCount: logMessages.data?.length ?? 0,
itemBuilder: (context, index) {
- var logMessage = logMessages.data![index];
+ final logMessage = logMessages.data![index];
return ListTile(
onTap: () => context.pushRoute(AppLogDetailRoute(logMessage: logMessage)),
trailing: const Icon(Icons.arrow_forward_ios_rounded),
@@ -116,7 +116,7 @@ class AppLogPage extends HookConsumerWidget {
/// Truncate the log message to a certain number of lines
/// @param int maxLines - Max number of lines to truncate
String truncateLogMessage(String message, int maxLines) {
- List<String> messageLines = message.split("\n");
+ final List<String> messageLines = message.split("\n");
if (messageLines.length < maxLines) {
return message;
}
diff --git a/mobile/lib/pages/common/app_log_detail.page.dart b/mobile/lib/pages/common/app_log_detail.page.dart
index 890e46888f..274231a729 100644
--- a/mobile/lib/pages/common/app_log_detail.page.dart
+++ b/mobile/lib/pages/common/app_log_detail.page.dart
@@ -14,7 +14,7 @@ class AppLogDetailPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
- buildTextWithCopyButton(String header, String text) {
+ Padding buildTextWithCopyButton(String header, String text) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@@ -66,7 +66,7 @@ class AppLogDetailPage extends HookConsumerWidget {
);
}
- buildLogContext(String logger) {
+ Padding buildLogContext(String logger) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@@ -87,7 +87,7 @@ class AppLogDetailPage extends HookConsumerWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SelectableText(
- logger.toString(),
+ logger,
style: const TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, fontFamily: "GoogleSansCode"),
),
),
diff --git a/mobile/lib/pages/common/download_panel.dart b/mobile/lib/pages/common/download_panel.dart
index 0775f5b4e4..f39aa07166 100644
--- a/mobile/lib/pages/common/download_panel.dart
+++ b/mobile/lib/pages/common/download_panel.dart
@@ -14,7 +14,7 @@ class DownloadPanel extends ConsumerWidget {
final tasks = ref.watch(downloadStateProvider.select((state) => state.taskProgress)).entries.toList();
- onCancelDownload(String id) {
+ void onCancelDownload(String id) {
ref.watch(downloadStateProvider.notifier).cancelDownload(id);
}
diff --git a/mobile/lib/pages/common/headers_settings.page.dart b/mobile/lib/pages/common/headers_settings.page.dart
index 9a6b602b04..f0b3f4b67f 100644
--- a/mobile/lib/pages/common/headers_settings.page.dart
+++ b/mobile/lib/pages/common/headers_settings.page.dart
@@ -41,7 +41,7 @@ class HeaderSettingsPage extends HookConsumerWidget {
}
setInitialHeaders.value = true;
- var list = [
+ final list = [
...headers.value.map((headerValue) {
return HeaderKeyValueSettings(
header: headerValue,
@@ -81,7 +81,7 @@ class HeaderSettingsPage extends HookConsumerWidget {
);
}
- saveHeaders(WidgetRef ref, List<SettingsHeader> headers) async {
+ Future<void> saveHeaders(WidgetRef ref, List<SettingsHeader> headers) async {
final headersMap = <String, String>{};
for (final header in headers) {
final key = header.key.trim();
diff --git a/mobile/lib/pages/common/splash_screen.page.dart b/mobile/lib/pages/common/splash_screen.page.dart
index 0d423875cb..711783bc94 100644
--- a/mobile/lib/pages/common/splash_screen.page.dart
+++ b/mobile/lib/pages/common/splash_screen.page.dart
@@ -25,7 +25,7 @@ import 'package:immich_mobile/theme/theme_data.dart';
import 'package:immich_mobile/widgets/common/immich_logo.dart';
import 'package:immich_mobile/widgets/common/immich_title_text.dart';
import 'package:logging/logging.dart';
-import 'package:url_launcher/url_launcher.dart' show launchUrl, LaunchMode;
+import 'package:url_launcher/url_launcher.dart' show LaunchMode, launchUrl;
class BootstrapErrorWidget extends StatelessWidget {
final String error;
@@ -297,7 +297,7 @@ class SplashScreenPageState extends ConsumerState<SplashScreenPage> {
log.info("Resuming session at $endpoint");
}
- void resumeSession() async {
+ Future<void> resumeSession() async {
final serverUrl = Store.tryGet(StoreKey.serverUrl);
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
final accessToken = Store.tryGet(StoreKey.accessToken);
diff --git a/mobile/lib/pages/library/folder/folder.page.dart b/mobile/lib/pages/library/folder/folder.page.dart
index 5efb5ccc62..6934d7b6c5 100644
--- a/mobile/lib/pages/library/folder/folder.page.dart
+++ b/mobile/lib/pages/library/folder/folder.page.dart
@@ -89,7 +89,7 @@ class FolderPage extends HookConsumerWidget {
if (folder == null) {
return FolderContent(folder: rootFolder, root: rootFolder, sortOrder: sortOrder.value);
} else {
- return FolderContent(folder: currentFolder.value!, root: rootFolder, sortOrder: sortOrder.value);
+ return FolderContent(folder: currentFolder.value, root: rootFolder, sortOrder: sortOrder.value);
}
},
loading: () => const Center(child: CircularProgressIndicator()),
@@ -126,7 +126,7 @@ class FolderContent extends HookConsumerWidget {
return Center(child: const Text("folder_not_found").tr());
}
- getSubtitle(int subFolderCount) {
+ String getSubtitle(int subFolderCount) {
if (subFolderCount > 0) {
return "$subFolderCount ${tr("folders")}".toLowerCase();
}
diff --git a/mobile/lib/pages/library/locked/pin_auth.page.dart b/mobile/lib/pages/library/locked/pin_auth.page.dart
index 3af320dc5f..7beda1d47b 100644
--- a/mobile/lib/pages/library/locked/pin_auth.page.dart
+++ b/mobile/lib/pages/library/locked/pin_auth.page.dart
@@ -38,7 +38,7 @@ class PinAuthPage extends HookConsumerWidget {
}
}
- enableBiometricAuth() {
+ void enableBiometricAuth() {
showDialog(
context: context,
builder: (buildContext) {
diff --git a/mobile/lib/pages/login/login.page.dart b/mobile/lib/pages/login/login.page.dart
index 5f40b32baa..79091d2679 100644
--- a/mobile/lib/pages/login/login.page.dart
+++ b/mobile/lib/pages/login/login.page.dart
@@ -4,8 +4,8 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/theme_extensions.dart';
-import 'package:immich_mobile/widgets/forms/login/login_form.dart';
import 'package:immich_mobile/routing/router.dart';
+import 'package:immich_mobile/widgets/forms/login/login_form.dart';
import 'package:package_info_plus/package_info_plus.dart';
@RoutePage()
@@ -16,8 +16,8 @@ class LoginPage extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final appVersion = useState('0.0.0');
- getAppInfo() async {
- PackageInfo packageInfo = await PackageInfo.fromPlatform();
+ Future<void> getAppInfo() async {
+ final PackageInfo packageInfo = await PackageInfo.fromPlatform();
appVersion.value = packageInfo.version;
}
diff --git a/mobile/lib/pages/search/map/map_location_picker.page.dart b/mobile/lib/pages/search/map/map_location_picker.page.dart
index 3dace15ced..96f41a4d38 100644
--- a/mobile/lib/pages/search/map/map_location_picker.page.dart
+++ b/mobile/lib/pages/search/map/map_location_picker.page.dart
@@ -41,13 +41,13 @@ class MapLocationPickerPage extends HookConsumerWidget {
}
Future<void> getCurrentLocation() async {
- var (currentLocation, _) = await MapUtils.checkPermAndGetLocation(context: context);
+ final (currentLocation, _) = await MapUtils.checkPermAndGetLocation(context: context);
if (currentLocation == null) {
return;
}
- var currentLatLng = LatLng(currentLocation.latitude, currentLocation.longitude);
+ final currentLatLng = LatLng(currentLocation.latitude, currentLocation.longitude);
selectedLatLng.value = currentLatLng;
await controller.value?.animateCamera(CameraUpdate.newLatLngZoom(currentLatLng, 12));
}
diff --git a/mobile/lib/pages/share_intent/share_intent.page.dart b/mobile/lib/pages/share_intent/share_intent.page.dart
index 2744b187de..ec88c4a9e4 100644
--- a/mobile/lib/pages/share_intent/share_intent.page.dart
+++ b/mobile/lib/pages/share_intent/share_intent.page.dart
@@ -35,7 +35,7 @@ class ShareIntentPage extends ConsumerWidget {
ref.read(shareIntentUploadProvider.notifier).addAttachments(attachments);
}
- void upload() async {
+ Future<void> upload() async {
final files = candidates.map((candidate) => candidate.file).toList();
await ref.read(shareIntentUploadProvider.notifier).uploadAll(files);
}
@@ -102,7 +102,7 @@ class ShareIntentPage extends ConsumerWidget {
Icons.image,
color: Colors.white,
size: 20,
- shadows: [Shadow(offset: Offset(0, 0), blurRadius: 8.0, color: Colors.black45)],
+ shadows: [Shadow(offset: Offset.zero, blurRadius: 8.0, color: Colors.black45)],
),
),
],
diff --git a/mobile/lib/presentation/pages/dev/main_timeline.page.dart b/mobile/lib/presentation/pages/dev/main_timeline.page.dart
index b78bbc2979..f2215d169c 100644
--- a/mobile/lib/presentation/pages/dev/main_timeline.page.dart
+++ b/mobile/lib/presentation/pages/dev/main_timeline.page.dart
@@ -1,9 +1,9 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:immich_mobile/presentation/widgets/feature_message/feature_message_dialog.widget.dart';
import 'package:immich_mobile/presentation/widgets/memory/memory_lane.widget.dart';
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
-import 'package:immich_mobile/presentation/widgets/feature_message/feature_message_dialog.widget.dart';
import 'package:immich_mobile/providers/feature_message.provider.dart';
import 'package:immich_mobile/providers/infrastructure/memory.provider.dart';
diff --git a/mobile/lib/presentation/pages/download_info.page.dart b/mobile/lib/presentation/pages/download_info.page.dart
index e805458e76..af44714b83 100644
--- a/mobile/lib/presentation/pages/download_info.page.dart
+++ b/mobile/lib/presentation/pages/download_info.page.dart
@@ -14,14 +14,14 @@ class DownloadInfoPage extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final tasks = ref.watch(downloadStateProvider.select((state) => state.taskProgress)).entries.toList();
- onCancelDownload(String id) {
+ void onCancelDownload(String id) {
ref.watch(downloadStateProvider.notifier).cancelDownload(id);
}
return Scaffold(
appBar: AppBar(
title: Text("download".t(context: context)),
- actions: [],
+ actions: const [],
),
body: ListView.builder(
physics: const ClampingScrollPhysics(),
diff --git a/mobile/lib/presentation/pages/drift_activities.page.dart b/mobile/lib/presentation/pages/drift_activities.page.dart
index b998e10dc2..a52f1d7358 100644
--- a/mobile/lib/presentation/pages/drift_activities.page.dart
+++ b/mobile/lib/presentation/pages/drift_activities.page.dart
@@ -45,7 +45,7 @@ class DriftActivitiesPage extends HookConsumerWidget {
if (assetName != null) Text(assetName!, style: context.textTheme.bodySmall),
],
),
- actions: [const LikeActivityActionButton(iconOnly: true)],
+ actions: const [LikeActivityActionButton(iconOnly: true)],
actionsPadding: const EdgeInsets.only(right: 8),
),
body: activities.widgetWhen(
diff --git a/mobile/lib/presentation/pages/drift_album_options.page.dart b/mobile/lib/presentation/pages/drift_album_options.page.dart
index 1a516426b5..84060aa38c 100644
--- a/mobile/lib/presentation/pages/drift_album_options.page.dart
+++ b/mobile/lib/presentation/pages/drift_album_options.page.dart
@@ -43,7 +43,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
);
}
- void leaveAlbum() async {
+ Future<void> leaveAlbum() async {
try {
await ref.read(remoteAlbumProvider.notifier).leaveAlbum(album.id, userId: userId);
unawaited(context.navigateTo(const DriftAlbumsRoute()));
@@ -52,7 +52,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
}
}
- void removeUserFromAlbum(UserDto user) async {
+ Future<void> removeUserFromAlbum(UserDto user) async {
try {
await ref.read(remoteAlbumProvider.notifier).removeUser(album.id, user.id);
ref.invalidate(remoteAlbumSharedUsersProvider(album.id));
@@ -83,11 +83,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
ref.invalidate(remoteAlbumSharedUsersProvider(album.id));
} catch (e) {
- ImmichToast.show(
- context: context,
- msg: "Failed to add users to album: ${e.toString()}",
- toastType: ToastType.error,
- );
+ ImmichToast.show(context: context, msg: "Failed to add users to album: $e", toastType: ToastType.error);
}
}
@@ -129,7 +125,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
);
}
- buildOwnerInfo() {
+ Widget buildOwnerInfo() {
if (isOwner) {
final owner = ref.watch(currentUserProvider);
return ListTile(
@@ -160,7 +156,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
}
}
- buildSharedUsersList() {
+ Widget buildSharedUsersList() {
return sharedUsersAsync.maybeWhen(
data: (sharedUsers) => ListView.builder(
primary: false,
@@ -181,7 +177,7 @@ class DriftAlbumOptionsPage extends HookConsumerWidget {
);
}
- buildSectionTitle(String text) {
+ Padding buildSectionTitle(String text) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Text(text, style: context.textTheme.bodySmall),
diff --git a/mobile/lib/presentation/pages/drift_library.page.dart b/mobile/lib/presentation/pages/drift_library.page.dart
index e93a58be7d..190ad3af6a 100644
--- a/mobile/lib/presentation/pages/drift_library.page.dart
+++ b/mobile/lib/presentation/pages/drift_library.page.dart
@@ -370,7 +370,7 @@ class _QuickAccessButtonList extends ConsumerWidget {
),
child: ListView(
shrinkWrap: true,
- padding: const EdgeInsets.all(0),
+ padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
children: [
ListTile(
@@ -422,7 +422,7 @@ class _PartnerList extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView.builder(
- padding: const EdgeInsets.all(0),
+ padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
itemCount: partners.length,
shrinkWrap: true,
diff --git a/mobile/lib/presentation/pages/drift_memory.page.dart b/mobile/lib/presentation/pages/drift_memory.page.dart
index f601bf8419..4ae97f30e1 100644
--- a/mobile/lib/presentation/pages/drift_memory.page.dart
+++ b/mobile/lib/presentation/pages/drift_memory.page.dart
@@ -7,10 +7,10 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/domain/models/memory.model.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
-import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/presentation/widgets/images/image_provider.dart';
import 'package:immich_mobile/presentation/widgets/memory/memory_bottom_info.widget.dart';
import 'package:immich_mobile/presentation/widgets/memory/memory_card.widget.dart';
+import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
import 'package:immich_mobile/utils/system_ui.utils.dart';
import 'package:immich_mobile/widgets/memories/memory_epilogue.dart';
@@ -54,7 +54,7 @@ class DriftMemoryPage extends HookConsumerWidget {
};
});
- toNextMemory() {
+ void toNextMemory() {
memoryPageController.nextPage(duration: const Duration(milliseconds: 500), curve: Curves.easeIn);
}
@@ -83,10 +83,10 @@ class DriftMemoryPage extends HookConsumerWidget {
}
}
- toNextAsset(int currentAssetIndex) {
+ void toNextAsset(int currentAssetIndex) {
if (currentAssetIndex + 1 < currentMemory.value.assets.length) {
// Go to the next asset
- PageController controller = memoryAssetPageControllers[currentMemoryIndex.value];
+ final PageController controller = memoryAssetPageControllers[currentMemoryIndex.value];
controller.nextPage(curve: Curves.easeInOut, duration: const Duration(milliseconds: 500));
} else {
@@ -95,10 +95,10 @@ class DriftMemoryPage extends HookConsumerWidget {
}
}
- toPreviousAsset(int currentAssetIndex) {
+ void toPreviousAsset(int currentAssetIndex) {
if (currentAssetIndex > 0) {
// Go to the previous asset
- PageController controller = memoryAssetPageControllers[currentMemoryIndex.value];
+ final PageController controller = memoryAssetPageControllers[currentMemoryIndex.value];
controller.previousPage(curve: Curves.easeInOut, duration: const Duration(milliseconds: 500));
} else {
@@ -107,12 +107,12 @@ class DriftMemoryPage extends HookConsumerWidget {
}
}
- updateProgressText() {
+ void updateProgressText() {
assetProgress.value = "${currentAssetPage.value + 1}|${currentMemory.value.assets.length}";
}
/// Downloads and caches the image for the asset at this [currentMemory]'s index
- precacheAsset(int index) async {
+ Future<void> precacheAsset(int index) async {
// Guard index out of range
if (index < 0) {
return;
diff --git a/mobile/lib/presentation/pages/drift_partner_detail.page.dart b/mobile/lib/presentation/pages/drift_partner_detail.page.dart
index 7df96cf78e..fd5b64c108 100644
--- a/mobile/lib/presentation/pages/drift_partner_detail.page.dart
+++ b/mobile/lib/presentation/pages/drift_partner_detail.page.dart
@@ -56,7 +56,7 @@ class _InfoBoxState extends ConsumerState<_InfoBox> {
_inTimeline = widget.partner.inTimeline;
}
- _toggleInTimeline() async {
+ Future<void> _toggleInTimeline() async {
final user = ref.read(currentUserProvider);
if (user == null) {
return;
diff --git a/mobile/lib/presentation/pages/drift_people_collection.page.dart b/mobile/lib/presentation/pages/drift_people_collection.page.dart
index 0afe723dc6..f39b5e15c7 100644
--- a/mobile/lib/presentation/pages/drift_people_collection.page.dart
+++ b/mobile/lib/presentation/pages/drift_people_collection.page.dart
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/string_extensions.dart';
-import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
import 'package:immich_mobile/presentation/widgets/images/remote_image_provider.dart';
+import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/utils/image_url_builder.dart';
import 'package:immich_mobile/utils/people.utils.dart';
diff --git a/mobile/lib/presentation/pages/drift_person.page.dart b/mobile/lib/presentation/pages/drift_person.page.dart
index 3430dd1abd..d4c280d010 100644
--- a/mobile/lib/presentation/pages/drift_person.page.dart
+++ b/mobile/lib/presentation/pages/drift_person.page.dart
@@ -24,7 +24,7 @@ class _DriftPersonPageState extends ConsumerState<DriftPersonPage> {
late DriftPerson _person;
@override
- initState() {
+ void initState() {
super.initState();
_person = widget.person;
}
diff --git a/mobile/lib/presentation/pages/drift_remote_album.page.dart b/mobile/lib/presentation/pages/drift_remote_album.page.dart
index ccbddb99f3..5e4e525e06 100644
--- a/mobile/lib/presentation/pages/drift_remote_album.page.dart
+++ b/mobile/lib/presentation/pages/drift_remote_album.page.dart
@@ -82,11 +82,7 @@ class _RemoteAlbumPageState extends ConsumerState<RemoteAlbumPage> {
ref.invalidate(remoteAlbumSharedUsersProvider(_album.id));
} catch (e) {
- ImmichToast.show(
- context: context,
- msg: "Failed to add users to album: ${e.toString()}",
- toastType: ToastType.error,
- );
+ ImmichToast.show(context: context, msg: "Failed to add users to album: $e", toastType: ToastType.error);
}
}
diff --git a/mobile/lib/presentation/pages/drift_slideshow.page.dart b/mobile/lib/presentation/pages/drift_slideshow.page.dart
index 260ed3ba78..3f0c441c01 100644
--- a/mobile/lib/presentation/pages/drift_slideshow.page.dart
+++ b/mobile/lib/presentation/pages/drift_slideshow.page.dart
@@ -54,7 +54,7 @@ class _DriftSlideshowPageState extends ConsumerState<DriftSlideshowPage> with Si
bool _disableAnimations = false;
@override
- initState() {
+ void initState() {
super.initState();
_config = ref.read(appConfigProvider.select((s) => s.slideshow));
final asset = ref.read(assetViewerProvider).currentAsset;
@@ -78,7 +78,7 @@ class _DriftSlideshowPageState extends ConsumerState<DriftSlideshowPage> with Si
}
@override
- dispose() {
+ void dispose() {
_timer.cancel();
_stopwatch.stop();
_pageController.dispose();
@@ -151,7 +151,7 @@ class _DriftSlideshowPageState extends ConsumerState<DriftSlideshowPage> with Si
}
}
- void _nextPage() async {
+ Future<void> _nextPage() async {
if (_nextIndex < 0 || _nextIndex >= widget.timeline.totalAssets) {
if (_config.repeat) {
final wrapped = _config.direction == SlideshowDirection.forward ? 0 : widget.timeline.totalAssets - 1;
@@ -267,7 +267,7 @@ class _DriftSlideshowPageState extends ConsumerState<DriftSlideshowPage> with Si
_updateNextIndex();
}
- void _onTapUp() async {
+ Future<void> _onTapUp() async {
await (_showAppBar ? SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive) : restoreEdgeToEdge());
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -295,7 +295,7 @@ class _DriftSlideshowPageState extends ConsumerState<DriftSlideshowPage> with Si
} else {
return LinearProgressIndicator(
color: context.colorScheme.primary,
- borderRadius: const BorderRadius.all(Radius.zero),
+ borderRadius: BorderRadius.zero,
minHeight: 5,
value:
ref.watch(videoPlayerProvider(asset.heroTag).select((s) => s.position)).inMilliseconds /
@@ -539,7 +539,7 @@ class _SlideshowProgressBarState extends State<_SlideshowProgressBar> with Singl
animation: _controller,
builder: (context, _) => LinearProgressIndicator(
color: widget.color,
- borderRadius: const BorderRadius.all(Radius.zero),
+ borderRadius: BorderRadius.zero,
minHeight: 5,
value: _controller.value,
),
diff --git a/mobile/lib/presentation/pages/drift_trash.page.dart b/mobile/lib/presentation/pages/drift_trash.page.dart
index d21b437efe..36db74a658 100644
--- a/mobile/lib/presentation/pages/drift_trash.page.dart
+++ b/mobile/lib/presentation/pages/drift_trash.page.dart
@@ -6,8 +6,8 @@ import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/generated/translations.g.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/bottom_sheet/trash_bottom_sheet.widget.dart';
-import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';
+import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
import 'package:immich_mobile/providers/server_info.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
@@ -41,7 +41,7 @@ class DriftTrashPage extends StatelessWidget {
pinned: true,
centerTitle: true,
elevation: 0,
- actions: [const _TrashKebabMenu()],
+ actions: const [_TrashKebabMenu()],
),
topSliverWidgetHeight: 24,
topSliverWidget: Consumer(
diff --git a/mobile/lib/presentation/pages/drift_user_selection.page.dart b/mobile/lib/presentation/pages/drift_user_selection.page.dart
index b73913fd02..41394014a0 100644
--- a/mobile/lib/presentation/pages/drift_user_selection.page.dart
+++ b/mobile/lib/presentation/pages/drift_user_selection.page.dart
@@ -52,11 +52,11 @@ class DriftUserSelectionPage extends HookConsumerWidget {
final AsyncValue<List<UserDto>> suggestedShareUsers = ref.watch(driftUsersProvider);
final sharedUsersList = useState<Set<UserDto>>({});
- addNewUsersHandler() {
+ void addNewUsersHandler() {
context.maybePop(sharedUsersList.value.map((e) => e.id).toList());
}
- buildTileIcon(UserDto user) {
+ Widget buildTileIcon(UserDto user) {
if (sharedUsersList.value.contains(user)) {
return CircleAvatar(backgroundColor: context.primaryColor, child: const Icon(Icons.check_rounded, size: 25));
} else {
@@ -64,8 +64,8 @@ class DriftUserSelectionPage extends HookConsumerWidget {
}
}
- buildUserList(List<UserDto> users) {
- List<Widget> usersChip = [];
+ ListView buildUserList(List<UserDto> users) {
+ final List<Widget> usersChip = [];
for (var user in sharedUsersList.value) {
usersChip.add(
@@ -91,7 +91,7 @@ class DriftUserSelectionPage extends HookConsumerWidget {
ListView.builder(
primary: false,
shrinkWrap: true,
- itemBuilder: ((context, index) {
+ itemBuilder: (context, index) {
return ListTile(
leading: buildTileIcon(users[index]),
dense: true,
@@ -107,7 +107,7 @@ class DriftUserSelectionPage extends HookConsumerWidget {
}
},
);
- }),
+ },
itemCount: users.length,
),
],
diff --git a/mobile/lib/presentation/pages/edit/drift_edit.page.dart b/mobile/lib/presentation/pages/edit/drift_edit.page.dart
index 2e2d39e386..0ce9985c19 100644
--- a/mobile/lib/presentation/pages/edit/drift_edit.page.dart
+++ b/mobile/lib/presentation/pages/edit/drift_edit.page.dart
@@ -15,7 +15,7 @@ import 'package:immich_mobile/theme/theme_data.dart';
import 'package:immich_mobile/utils/editor.utils.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:immich_ui/immich_ui.dart';
-import 'package:openapi/api.dart' show RotateParameters, MirrorParameters, MirrorAxis;
+import 'package:openapi/api.dart' show MirrorAxis, MirrorParameters, RotateParameters;
@RoutePage()
class DriftEditImagePage extends ConsumerStatefulWidget {
diff --git a/mobile/lib/presentation/pages/edit/editor.provider.dart b/mobile/lib/presentation/pages/edit/editor.provider.dart
index 69c8b7bf54..3d97f2173f 100644
--- a/mobile/lib/presentation/pages/edit/editor.provider.dart
+++ b/mobile/lib/presentation/pages/edit/editor.provider.dart
@@ -25,7 +25,7 @@ class EditorProvider extends Notifier<EditorState> {
final originalWidth = exifInfo.isFlipped ? exifInfo.height : exifInfo.width;
final originalHeight = exifInfo.isFlipped ? exifInfo.width : exifInfo.height;
- Rect crop = existingCrop != null && originalWidth != null && originalHeight != null
+ final Rect crop = existingCrop != null && originalWidth != null && originalHeight != null
? convertCropParametersToRect(existingCrop.parameters, originalWidth, originalHeight)
: const Rect.fromLTRB(0, 0, 1, 1);
diff --git a/mobile/lib/presentation/pages/search/drift_search.page.dart b/mobile/lib/presentation/pages/search/drift_search.page.dart
index 22546b8e50..6b818bd273 100644
--- a/mobile/lib/presentation/pages/search/drift_search.page.dart
+++ b/mobile/lib/presentation/pages/search/drift_search.page.dart
@@ -80,7 +80,7 @@ class DriftSearchPage extends HookConsumerWidget {
final userPreferences = ref.watch(userMetadataPreferencesProvider);
- search(SearchFilter f) {
+ void search(SearchFilter f) {
if (f == filter.value) {
return;
}
@@ -94,7 +94,7 @@ class DriftSearchPage extends HookConsumerWidget {
}
}
- loadMoreSearchResults() {
+ void loadMoreSearchResults() {
unawaited(ref.read(paginatedSearchProvider.notifier).search(filter.value));
}
@@ -123,19 +123,19 @@ class DriftSearchPage extends HookConsumerWidget {
return null;
}, [preFilter]);
- showPeoplePicker() {
+ void showPeoplePicker() {
var people = filter.value.people;
- handleOnSelect(Set<PersonDto> value) {
+ void handleOnSelect(Set<PersonDto> value) {
people = value;
}
- handleClear() {
+ void handleClear() {
peopleCurrentFilterWidget.value = null;
search(filter.value.copyWith(people: {}));
}
- handleApply() {
+ void handleApply() {
final label = people.map((e) => e.name != '' ? e.name : 'no_name'.t(context: context)).join(', ');
peopleCurrentFilterWidget.value = label.isNotEmpty ? Text(label, style: context.textTheme.labelLarge) : null;
search(filter.value.copyWith(people: people));
@@ -157,21 +157,21 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- showTagPicker() {
+ void showTagPicker() {
var tagIds = filter.value.tagIds ?? [];
String tagLabel = '';
- handleOnSelect(Iterable<Tag> tags) {
+ void handleOnSelect(Iterable<Tag> tags) {
tagIds = tags.map((t) => t.id).toList();
tagLabel = tags.map((t) => t.value).join(', ');
}
- handleClear() {
+ void handleClear() {
tagCurrentFilterWidget.value = null;
search(filter.value.copyWith(tagIds: []));
}
- handleApply() {
+ void handleApply() {
tagCurrentFilterWidget.value = tagLabel.isNotEmpty ? Text(tagLabel, style: context.textTheme.labelLarge) : null;
search(filter.value.copyWith(tagIds: tagIds));
}
@@ -192,19 +192,19 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- showLocationPicker() {
+ void showLocationPicker() {
var location = filter.value.location;
- handleOnSelect(Map<String, String?> value) {
+ void handleOnSelect(Map<String, String?> value) {
location = SearchLocationFilter(country: value['country'], city: value['city'], state: value['state']);
}
- handleClear() {
+ void handleClear() {
locationCurrentFilterWidget.value = null;
search(filter.value.copyWith(location: SearchLocationFilter()));
}
- handleApply() {
+ void handleApply() {
final locationText = [
if (location.country != null) location.country!,
if (location.state != null) location.state!,
@@ -238,19 +238,19 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- showCameraPicker() {
+ void showCameraPicker() {
var camera = filter.value.camera;
- handleOnSelect(Map<String, String?> value) {
+ void handleOnSelect(Map<String, String?> value) {
camera = SearchCameraFilter(make: value['make'], model: value['model']);
}
- handleClear() {
+ void handleClear() {
cameraCurrentFilterWidget.value = null;
search(filter.value.copyWith(camera: SearchCameraFilter()));
}
- handleApply() {
+ void handleApply() {
final make = camera.make ?? '';
final model = camera.model ?? '';
cameraCurrentFilterWidget.value = (make.isNotEmpty || model.isNotEmpty)
@@ -275,7 +275,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- datePicked(DateFilterInputModel? selectedDate) {
+ void datePicked(DateFilterInputModel? selectedDate) {
dateInputFilter.value = selectedDate;
if (selectedDate == null) {
dateRangeCurrentFilterWidget.value = null;
@@ -298,7 +298,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- showDatePicker() async {
+ Future<void> showDatePicker() async {
final firstDate = DateTime(1900);
final lastDate = DateTime.now();
@@ -338,7 +338,7 @@ class DriftSearchPage extends HookConsumerWidget {
}
}
- showQuickDatePicker() {
+ void showQuickDatePicker() {
showFilterBottomSheet(
context: context,
child: FilterBottomSheetScaffold(
@@ -361,19 +361,19 @@ class DriftSearchPage extends HookConsumerWidget {
}
// MEDIA PICKER
- showMediaTypePicker() {
+ void showMediaTypePicker() {
var mediaType = filter.value.mediaType;
- handleOnSelected(AssetType assetType) {
+ void handleOnSelected(AssetType assetType) {
mediaType = assetType;
}
- handleClear() {
+ void handleClear() {
mediaTypeCurrentFilterWidget.value = null;
search(filter.value.copyWith(mediaType: AssetType.other));
}
- handleApply() {
+ void handleApply() {
mediaTypeCurrentFilterWidget.value = mediaType != AssetType.other
? Text(
mediaType == AssetType.image ? 'image'.t(context: context) : 'video'.t(context: context),
@@ -395,19 +395,19 @@ class DriftSearchPage extends HookConsumerWidget {
}
// STAR RATING PICKER
- showStarRatingPicker() {
+ void showStarRatingPicker() {
var rating = filter.value.rating;
- handleOnSelected(SearchRatingFilter value) {
+ void handleOnSelected(SearchRatingFilter value) {
rating = value;
}
- handleClear() {
+ void handleClear() {
ratingCurrentFilterWidget.value = null;
search(filter.value.copyWith(rating: SearchRatingFilter()));
}
- handleApply() {
+ void handleApply() {
ratingCurrentFilterWidget.value = rating.rating.isSome
? Text(
'rating_count'.t(args: {'count': rating.rating.unwrapOrNull ?? 0}),
@@ -430,10 +430,10 @@ class DriftSearchPage extends HookConsumerWidget {
}
// DISPLAY OPTION
- showDisplayOptionPicker() {
+ void showDisplayOptionPicker() {
var display = filter.value.display;
- handleOnSelect(Map<DisplayOption, bool> value) {
+ void handleOnSelect(Map<DisplayOption, bool> value) {
display = display.copyWith(
isNotInAlbum: value[DisplayOption.notInAlbum],
isArchive: value[DisplayOption.archive],
@@ -441,7 +441,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- handleClear() {
+ void handleClear() {
displayOptionCurrentFilterWidget.value = null;
search(
filter.value.copyWith(
@@ -450,7 +450,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- handleApply() {
+ void handleApply() {
final filterText = [
if (display.isNotInAlbum) 'search_filter_display_option_not_in_album'.t(context: context),
if (display.isArchive) 'archive'.t(context: context),
@@ -473,7 +473,7 @@ class DriftSearchPage extends HookConsumerWidget {
);
}
- handleTextSubmitted(String value) => search(switch (textSearchType.value) {
+ void handleTextSubmitted(String value) => search(switch (textSearchType.value) {
TextSearchType.context => filter.value.copyWith(filename: '', context: value, description: '', ocr: ''),
TextSearchType.filename => filter.value.copyWith(filename: value, context: '', description: '', ocr: ''),
TextSearchType.description => filter.value.copyWith(filename: '', context: '', description: value, ocr: ''),
diff --git a/mobile/lib/presentation/widgets/action_buttons/add_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/add_action_button.widget.dart
index dc48ed57ec..86d3fa0749 100644
--- a/mobile/lib/presentation/widgets/action_buttons/add_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/add_action_button.widget.dart
@@ -1,25 +1,23 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:immich_mobile/constants/enums.dart';
+import 'package:immich_mobile/domain/models/album/album.model.dart';
+import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
+import 'package:immich_mobile/presentation/widgets/action_buttons/archive_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
+import 'package:immich_mobile/presentation/widgets/action_buttons/move_to_lock_folder_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/unarchive_action_button.widget.dart';
-import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/presentation/widgets/album/album_selector.widget.dart';
+import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart';
+import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
import 'package:immich_mobile/providers/routes.provider.dart';
-import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:immich_mobile/providers/user.provider.dart';
-
-import 'package:immich_mobile/domain/models/album/album.model.dart';
-import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
-
-import 'package:immich_mobile/constants/enums.dart';
-import 'package:immich_mobile/presentation/widgets/action_buttons/archive_action_button.widget.dart';
-import 'package:immich_mobile/presentation/widgets/action_buttons/move_to_lock_folder_action_button.widget.dart';
-import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart';
+import 'package:immich_mobile/widgets/common/immich_toast.dart';
enum AddToMenuItem { album, archive, unarchive, lockedFolder }
@@ -37,16 +35,12 @@ class _AddActionButtonState extends ConsumerState<AddActionButton> {
switch (selected) {
case AddToMenuItem.album:
_openAlbumSelector();
- break;
case AddToMenuItem.archive:
performArchiveAction(context, ref, source: ActionSource.viewer);
- break;
case AddToMenuItem.unarchive:
performUnArchiveAction(context, ref, source: ActionSource.viewer);
- break;
case AddToMenuItem.lockedFolder:
performMoveToLockFolderAction(context, ref, source: ActionSource.viewer);
- break;
}
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/delete_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/delete_action_button.widget.dart
index 2a7c4ba9d7..45dc5ec699 100644
--- a/mobile/lib/presentation/widgets/action_buttons/delete_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/delete_action_button.widget.dart
@@ -30,7 +30,7 @@ class DeleteActionButton extends ConsumerWidget {
this.menuItem = false,
});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/delete_local_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/delete_local_action_button.widget.dart
index 6911d09f89..5a94d9807e 100644
--- a/mobile/lib/presentation/widgets/action_buttons/delete_local_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/delete_local_action_button.widget.dart
@@ -7,9 +7,9 @@ import 'package:immich_mobile/domain/utils/event_stream.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
-import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
/// This delete action has the following behavior:
/// - Prompt to delete the asset locally
@@ -20,7 +20,7 @@ class DeleteLocalActionButton extends ConsumerWidget {
const DeleteLocalActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/delete_permanent_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/delete_permanent_action_button.widget.dart
index 267a9f55e6..922f8593fa 100644
--- a/mobile/lib/presentation/widgets/action_buttons/delete_permanent_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/delete_permanent_action_button.widget.dart
@@ -28,7 +28,7 @@ class DeletePermanentActionButton extends ConsumerWidget {
this.useShortLabel = false,
});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart
index d19a188561..f3e048f06f 100644
--- a/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/delete_trash_action_button.widget.dart
@@ -18,7 +18,7 @@ class DeleteTrashActionButton extends ConsumerWidget {
const DeleteTrashActionButton({super.key, required this.source});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/download_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/download_action_button.widget.dart
index a5129b643a..b6f8cc614e 100644
--- a/mobile/lib/presentation/widgets/action_buttons/download_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/download_action_button.widget.dart
@@ -1,6 +1,6 @@
-import 'package:immich_mobile/constants/enums.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:immich_mobile/constants/enums.dart';
import 'package:immich_mobile/domain/utils/background_sync.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
@@ -14,7 +14,7 @@ class DownloadActionButton extends ConsumerWidget {
final bool menuItem;
const DownloadActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref, BackgroundSyncManager backgroundSyncManager) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref, BackgroundSyncManager backgroundSyncManager) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/edit_date_time_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/edit_date_time_action_button.widget.dart
index 6eeec0658b..b2b5050a8e 100644
--- a/mobile/lib/presentation/widgets/action_buttons/edit_date_time_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/edit_date_time_action_button.widget.dart
@@ -13,7 +13,7 @@ class EditDateTimeActionButton extends ConsumerWidget {
const EditDateTimeActionButton({super.key, required this.source});
- _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/edit_location_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/edit_location_action_button.widget.dart
index 1a8a1a5c39..cc8e15617c 100644
--- a/mobile/lib/presentation/widgets/action_buttons/edit_location_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/edit_location_action_button.widget.dart
@@ -13,7 +13,7 @@ class EditLocationActionButton extends ConsumerWidget {
const EditLocationActionButton({super.key, required this.source});
- _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/favorite_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/favorite_action_button.widget.dart
index 07ace7e631..0365335fd2 100644
--- a/mobile/lib/presentation/widgets/action_buttons/favorite_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/favorite_action_button.widget.dart
@@ -17,7 +17,7 @@ class FavoriteActionButton extends ConsumerWidget {
const FavoriteActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/like_activity_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/like_activity_action_button.widget.dart
index 4cb973cca1..46a5c2c41e 100644
--- a/mobile/lib/presentation/widgets/action_buttons/like_activity_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/like_activity_action_button.widget.dart
@@ -25,7 +25,7 @@ class LikeActivityActionButton extends ConsumerWidget {
final activities = ref.watch(albumActivityProvider((album?.id ?? "", asset?.id)));
- onTap(Activity? liked) async {
+ Future<void> onTap(Activity? liked) async {
if (user == null) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/open_in_browser_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/open_in_browser_action_button.widget.dart
index 541a9f8093..adf73e4107 100644
--- a/mobile/lib/presentation/widgets/action_buttons/open_in_browser_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/open_in_browser_action_button.widget.dart
@@ -21,20 +21,17 @@ class OpenInBrowserActionButton extends ConsumerWidget {
this.menuItem = false,
});
- void _onTap() async {
+ Future<void> _onTap() async {
final serverEndpoint = Store.get(StoreKey.serverEndpoint).replaceFirst('/api', '');
String originPath = '';
switch (origin) {
case TimelineOrigin.favorite:
originPath = '/favorites';
- break;
case TimelineOrigin.trash:
originPath = '/trash';
- break;
case TimelineOrigin.archive:
originPath = '/archive';
- break;
default:
break;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/remove_from_album_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/remove_from_album_action_button.widget.dart
index 97a36a56dc..ebcfbaa1e5 100644
--- a/mobile/lib/presentation/widgets/action_buttons/remove_from_album_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/remove_from_album_action_button.widget.dart
@@ -24,7 +24,7 @@ class RemoveFromAlbumActionButton extends ConsumerWidget {
this.menuItem = false,
});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/remove_from_lock_folder_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/remove_from_lock_folder_action_button.widget.dart
index 17d2a76af7..75deef9ccb 100644
--- a/mobile/lib/presentation/widgets/action_buttons/remove_from_lock_folder_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/remove_from_lock_folder_action_button.widget.dart
@@ -20,7 +20,7 @@ class RemoveFromLockFolderActionButton extends ConsumerWidget {
this.menuItem = false,
});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/restore_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/restore_action_button.widget.dart
index 1713718967..b752a77c89 100644
--- a/mobile/lib/presentation/widgets/action_buttons/restore_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/restore_action_button.widget.dart
@@ -17,7 +17,7 @@ class RestoreActionButton extends ConsumerWidget {
const RestoreActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/restore_trash_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/restore_trash_action_button.widget.dart
index e7928bd325..82a9d98549 100644
--- a/mobile/lib/presentation/widgets/action_buttons/restore_trash_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/restore_trash_action_button.widget.dart
@@ -12,7 +12,7 @@ class RestoreTrashActionButton extends ConsumerWidget {
const RestoreTrashActionButton({super.key, required this.source});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/set_album_cover.widget.dart b/mobile/lib/presentation/widgets/action_buttons/set_album_cover.widget.dart
index 1d704aafe8..d080efc5b2 100644
--- a/mobile/lib/presentation/widgets/action_buttons/set_album_cover.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/set_album_cover.widget.dart
@@ -22,7 +22,7 @@ class SetAlbumCoverActionButton extends ConsumerWidget {
this.menuItem = false,
});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/share_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/share_action_button.widget.dart
index eef87f299d..ef520ea941 100644
--- a/mobile/lib/presentation/widgets/action_buttons/share_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/share_action_button.widget.dart
@@ -93,13 +93,13 @@ class ShareActionButton extends ConsumerWidget {
return switch (source) {
ActionSource.timeline => ref.read(multiSelectProvider).selectedAssets,
ActionSource.viewer => switch (ref.read(assetViewerProvider).currentAsset) {
- BaseAsset asset => {asset},
+ final BaseAsset asset => {asset},
null => const {},
},
};
}
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
@@ -108,7 +108,7 @@ class ShareActionButton extends ConsumerWidget {
await _share(context, ref, fileType);
}
- void _onLongPress(BuildContext context, WidgetRef ref) async {
+ Future<void> _onLongPress(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/share_link_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/share_link_action_button.widget.dart
index b8dc69f515..dfe8fad025 100644
--- a/mobile/lib/presentation/widgets/action_buttons/share_link_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/share_link_action_button.widget.dart
@@ -12,7 +12,7 @@ class ShareLinkActionButton extends ConsumerWidget {
const ShareLinkActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/similar_photos_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/similar_photos_action_button.widget.dart
index 42dcfa683a..02da265f31 100644
--- a/mobile/lib/presentation/widgets/action_buttons/similar_photos_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/similar_photos_action_button.widget.dart
@@ -18,7 +18,7 @@ class SimilarPhotosActionButton extends ConsumerWidget {
const SimilarPhotosActionButton({super.key, required this.assetId, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/stack_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/stack_action_button.widget.dart
index 22fccf5473..b87d288a3e 100644
--- a/mobile/lib/presentation/widgets/action_buttons/stack_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/stack_action_button.widget.dart
@@ -14,7 +14,7 @@ class StackActionButton extends ConsumerWidget {
const StackActionButton({super.key, required this.source});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/trash_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/trash_action_button.widget.dart
index e95569af45..a320d3b1b1 100644
--- a/mobile/lib/presentation/widgets/action_buttons/trash_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/trash_action_button.widget.dart
@@ -20,7 +20,7 @@ class TrashActionButton extends ConsumerWidget {
const TrashActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/unarchive_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/unarchive_action_button.widget.dart
index 57221303a8..78984f9ef1 100644
--- a/mobile/lib/presentation/widgets/action_buttons/unarchive_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/unarchive_action_button.widget.dart
@@ -4,13 +4,13 @@ import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/enums.dart';
+import 'package:immich_mobile/domain/models/events.model.dart';
+import 'package:immich_mobile/domain/utils/event_stream.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/base_action_button.widget.dart';
import 'package:immich_mobile/providers/infrastructure/action.provider.dart';
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
-import 'package:immich_mobile/domain/models/events.model.dart';
-import 'package:immich_mobile/domain/utils/event_stream.dart';
// used to allow performing unarchive action from different sources (without duplicating code)
Future<void> performUnArchiveAction(BuildContext context, WidgetRef ref, {required ActionSource source}) async {
diff --git a/mobile/lib/presentation/widgets/action_buttons/unfavorite_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/unfavorite_action_button.widget.dart
index 5e88735d9c..94d6588074 100644
--- a/mobile/lib/presentation/widgets/action_buttons/unfavorite_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/unfavorite_action_button.widget.dart
@@ -17,7 +17,7 @@ class UnFavoriteActionButton extends ConsumerWidget {
const UnFavoriteActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/unstack_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/unstack_action_button.widget.dart
index e7badf129f..c9a5102a9b 100644
--- a/mobile/lib/presentation/widgets/action_buttons/unstack_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/unstack_action_button.widget.dart
@@ -15,7 +15,7 @@ class UnStackActionButton extends ConsumerWidget {
const UnStackActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/action_buttons/upload_action_button.widget.dart b/mobile/lib/presentation/widgets/action_buttons/upload_action_button.widget.dart
index 599e11d467..1d09ad23a8 100644
--- a/mobile/lib/presentation/widgets/action_buttons/upload_action_button.widget.dart
+++ b/mobile/lib/presentation/widgets/action_buttons/upload_action_button.widget.dart
@@ -24,7 +24,7 @@ class UploadActionButton extends ConsumerWidget {
const UploadActionButton({super.key, required this.source, this.iconOnly = false, this.menuItem = false});
- void _onTap(BuildContext context, WidgetRef ref) async {
+ Future<void> _onTap(BuildContext context, WidgetRef ref) async {
if (!context.mounted) {
return;
}
diff --git a/mobile/lib/presentation/widgets/album/album_selector.widget.dart b/mobile/lib/presentation/widgets/album/album_selector.widget.dart
index 44abfba47e..285c6290a9 100644
--- a/mobile/lib/presentation/widgets/album/album_selector.widget.dart
+++ b/mobile/lib/presentation/widgets/album/album_selector.widget.dart
@@ -774,7 +774,7 @@ class AddToAlbumHeader extends ConsumerWidget {
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), // remove internal padding
- minimumSize: const Size(0, 0), // allow shrinking
+ minimumSize: Size.zero, // allow shrinking
tapTargetSize: MaterialTapTargetSize.shrinkWrap, // remove extra height
),
onPressed: onCreateAlbum,
@@ -797,7 +797,7 @@ class CreateAlbumButton extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> onCreateAlbum() async {
- var albumName = await showDialog<String?>(context: context, builder: (context) => const NewAlbumNameModal());
+ final albumName = await showDialog<String?>(context: context, builder: (context) => const NewAlbumNameModal());
if (albumName == null) {
return;
}
@@ -839,7 +839,7 @@ class CreateAlbumButton extends ConsumerWidget {
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
- minimumSize: const Size(0, 0),
+ minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: onCreateAlbum,
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_details/appears_in_details.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_details/appears_in_details.widget.dart
index 6a565fa2cd..dffda47b84 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_details/appears_in_details.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_details/appears_in_details.widget.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+
import 'package:auto_route/auto_route.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
@@ -8,8 +9,8 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/theme_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/album/album_tile.dart';
-import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/sheet_tile.widget.dart';
+import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
import 'package:immich_mobile/routing/router.dart';
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_details/location_details.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_details/location_details.widget.dart
index 8c144a83bd..379f0975b1 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_details/location_details.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_details/location_details.widget.dart
@@ -53,7 +53,7 @@ class _LocationDetailsState extends ConsumerState<LocationDetails> {
}
}
- void editLocation() async {
+ Future<void> editLocation() async {
await ref.read(actionProvider.notifier).editLocation(ActionSource.viewer, context);
}
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_details/rating_details.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_details/rating_details.widget.dart
index e501c2ee3e..352838c761 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_details/rating_details.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_details/rating_details.widget.dart
@@ -41,7 +41,7 @@ class RatingDetails extends ConsumerWidget {
unfilledColor: context.themeData.colorScheme.onSurface.withAlpha(100),
itemSize: 40,
onRatingUpdate: (rating) async {
- await ref.read(actionProvider.notifier).updateRating(ActionSource.viewer, rating.round());
+ await ref.read(actionProvider.notifier).updateRating(ActionSource.viewer, rating);
},
onClearRating: () async {
await ref.read(actionProvider.notifier).updateRating(ActionSource.viewer, null);
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_details/technical_details.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_details/technical_details.widget.dart
index 33e0fa38f5..e97fa4889b 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_details/technical_details.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_details/technical_details.widget.dart
@@ -99,14 +99,14 @@ class TechnicalDetails extends ConsumerWidget {
static String _getFileInfo(BaseAsset asset, ExifInfo? exifInfo) {
final height = asset.height;
final width = asset.width;
- final resolution = (width != null && height != null) ? "${width.toInt()} x ${height.toInt()}" : null;
+ final resolution = (width != null && height != null) ? "$width x $height" : null;
final fileSize = exifInfo?.fileSize != null ? formatBytes(exifInfo!.fileSize!) : null;
return switch ((fileSize, resolution)) {
(null, null) => '',
- (String fileSize, null) => fileSize,
- (null, String resolution) => resolution,
- (String fileSize, String resolution) => '$fileSize$_kSeparator$resolution',
+ (final String fileSize, null) => fileSize,
+ (null, final String resolution) => resolution,
+ (final String fileSize, final String resolution) => '$fileSize$_kSeparator$resolution',
};
}
@@ -116,9 +116,9 @@ class TechnicalDetails extends ConsumerWidget {
}
return switch ((exifInfo.make, exifInfo.model)) {
(null, null) => null,
- (String make, null) => make,
- (null, String model) => model,
- (String make, String model) => '$make $model',
+ (final String make, null) => make,
+ (null, final String model) => model,
+ (final String make, final String model) => '$make $model',
};
}
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_stack.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_stack.widget.dart
index f5d75a6a86..23c473e618 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_stack.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_stack.widget.dart
@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/domain/services/timeline.service.dart';
-import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
+import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
class AssetStackRow extends ConsumerWidget {
@@ -23,7 +23,8 @@ class AssetStackRow extends ConsumerWidget {
}
final showingControls = ref.watch(assetViewerProvider.select((s) => s.showingControls));
- double opacity = ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
+ final double opacity =
+ ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
return IgnorePointer(
ignoring: opacity < 1.0,
@@ -75,7 +76,7 @@ class _StackItemState extends ConsumerState<_StackItem> {
Icons.play_circle_outline_rounded,
color: Colors.white,
size: 16,
- shadows: [Shadow(blurRadius: 5.0, color: Color.fromRGBO(0, 0, 0, 0.6), offset: Offset(0.0, 0.0))],
+ shadows: [Shadow(blurRadius: 5.0, color: Color.fromRGBO(0, 0, 0, 0.6), offset: Offset.zero)],
),
);
const selectedDecoration = BoxDecoration(
diff --git a/mobile/lib/presentation/widgets/asset_viewer/asset_viewer.page.dart b/mobile/lib/presentation/widgets/asset_viewer/asset_viewer.page.dart
index 1065ebe25e..3952dafdb2 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/asset_viewer.page.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/asset_viewer.page.dart
@@ -167,7 +167,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
_handleCasting();
}
- void _onAssetChanged(int index) async {
+ Future<void> _onAssetChanged(int index) async {
_currentPage = index;
final asset = await ref.read(timelineServiceProvider).getAssetAsync(index);
@@ -222,7 +222,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
_onTimelineReloadEvent();
case ViewerReloadAssetEvent():
_onViewerReloadEvent();
- case ViewerStackAssetDeletedEvent event:
+ case final ViewerStackAssetDeletedEvent event:
_onViewerStackAssetDeletedEvent(event);
default:
}
diff --git a/mobile/lib/presentation/widgets/asset_viewer/rating_bar.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/rating_bar.widget.dart
index b956ef103c..0ed37869be 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/rating_bar.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/rating_bar.widget.dart
@@ -64,8 +64,8 @@ class _RatingBarState extends State<RatingBar> {
} else if (dx >= totalWidth) {
newRating = widget.itemCount.toDouble();
} else {
- double starWithPadding = widget.itemSize + widget.starPadding;
- int tappedIndex = (dx / starWithPadding).floor().clamp(0, widget.itemCount - 1);
+ final double starWithPadding = widget.itemSize + widget.starPadding;
+ final int tappedIndex = (dx / starWithPadding).floor().clamp(0, widget.itemCount - 1);
newRating = tappedIndex + 1.0;
if (isTap && newRating == _currentRating && _currentRating != 0) {
@@ -88,7 +88,7 @@ class _RatingBarState extends State<RatingBar> {
@override
Widget build(BuildContext context) {
final isRTL = Directionality.of(context) == TextDirection.rtl;
- final double visualAlignmentOffset = 5.0;
+ const double visualAlignmentOffset = 5.0;
return Column(
mainAxisSize: MainAxisSize.min,
@@ -107,8 +107,8 @@ class _RatingBarState extends State<RatingBar> {
if (i.isOdd) {
return SizedBox(width: widget.starPadding);
}
- int index = i ~/ 2;
- bool filled = _currentRating > index;
+ final int index = i ~/ 2;
+ final bool filled = _currentRating > index;
return widget.itemBuilder ??
Icon(
Icons.star_rounded,
diff --git a/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart
index ccbaf7660a..d007883ec9 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart
@@ -83,7 +83,7 @@ class _NativeVideoViewerState extends ConsumerState<NativeVideoViewer> with Widg
}
@override
- void didChangeAppLifecycleState(AppLifecycleState state) async {
+ Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
switch (state) {
case AppLifecycleState.resumed:
if (_shouldPlayOnForeground) {
@@ -198,7 +198,7 @@ class _NativeVideoViewerState extends ConsumerState<NativeVideoViewer> with Widg
return localAsset;
}
- void _onPlaybackReady() async {
+ Future<void> _onPlaybackReady() async {
if (!mounted || !widget.isCurrent) {
return;
}
@@ -257,7 +257,7 @@ class _NativeVideoViewerState extends ConsumerState<NativeVideoViewer> with Widg
_controller?.onPlaybackEnded.removeListener(_onPlaybackEnded);
}
- void _loadVideo() async {
+ Future<void> _loadVideo() async {
final nc = _controller;
if (nc == null || nc.videoSource != null || !mounted) {
return;
diff --git a/mobile/lib/presentation/widgets/asset_viewer/viewer_bottom_app_bar.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/viewer_bottom_app_bar.widget.dart
index 1c0b600843..0e7b5661de 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/viewer_bottom_app_bar.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/viewer_bottom_app_bar.widget.dart
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/bottom_bar.widget.dart';
+import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
class ViewerBottomAppBar extends ConsumerWidget {
const ViewerBottomAppBar({super.key});
@@ -9,7 +9,8 @@ class ViewerBottomAppBar extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final showingControls = ref.watch(assetViewerProvider.select((s) => s.showingControls));
- double opacity = ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
+ final double opacity =
+ ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
return IgnorePointer(
ignoring: opacity < 1.0,
diff --git a/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart
index 5997e15bf0..878a1c9405 100644
--- a/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart
+++ b/mobile/lib/presentation/widgets/asset_viewer/viewer_top_app_bar.widget.dart
@@ -40,7 +40,8 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
}
final showingControls = ref.watch(assetViewerProvider.select((s) => s.showingControls));
- double opacity = ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
+ final double opacity =
+ ref.watch(assetViewerProvider.select((s) => s.backgroundOpacity)) * (showingControls ? 1 : 0);
final originalTheme = context.themeData;
final assetForAction = [asset];
diff --git a/mobile/lib/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart b/mobile/lib/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart
index 0d0e0259fd..d5ed3f6c96 100644
--- a/mobile/lib/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart
+++ b/mobile/lib/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart
@@ -74,7 +74,7 @@ class _BaseDraggableScrollableSheetState extends ConsumerState<BaseBottomSheet>
color: widget.backgroundColor ?? context.colorScheme.surfaceContainer,
elevation: 3.0,
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(18))),
- margin: const EdgeInsets.symmetric(horizontal: 0),
+ margin: EdgeInsets.zero,
child: Column(
children: [
Expanded(
diff --git a/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart b/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
index 945bdc9584..06d1ddc99d 100644
--- a/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
+++ b/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart
@@ -21,10 +21,10 @@ class MapBottomSheet extends StatelessWidget {
maxChildSize: 0.75,
shouldCloseOnMinExtent: false,
resizeOnScroll: false,
- actions: [],
+ actions: const [],
backgroundColor: context.themeData.colorScheme.surface,
- slivers: [
- const SliverFillRemaining(hasScrollBody: false, child: SizedBox(height: 0, child: _ScopedMapTimeline())),
+ slivers: const [
+ SliverFillRemaining(hasScrollBody: false, child: SizedBox(height: 0, child: _ScopedMapTimeline())),
],
);
}
diff --git a/mobile/lib/presentation/widgets/feature_message/feature_message_dialog.widget.dart b/mobile/lib/presentation/widgets/feature_message/feature_message_dialog.widget.dart
index 9727ec29e4..2c89c68d99 100644
--- a/mobile/lib/presentation/widgets/feature_message/feature_message_dialog.widget.dart
+++ b/mobile/lib/presentation/widgets/feature_message/feature_message_dialog.widget.dart
@@ -4,10 +4,10 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:immich_mobile/domain/models/feature_message.model.dart';
-import 'package:immich_mobile/presentation/widgets/feature_message/feature_message_placeholder.widget.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
-import 'package:immich_mobile/generated/translations.g.dart';
import 'package:immich_mobile/extensions/theme_extensions.dart';
+import 'package:immich_mobile/generated/translations.g.dart';
+import 'package:immich_mobile/presentation/widgets/feature_message/feature_message_placeholder.widget.dart';
Future<void> showFeatureMessageDialog(BuildContext context) {
return showGeneralDialog<void>(
diff --git a/mobile/lib/presentation/widgets/images/full_image.widget.dart b/mobile/lib/presentation/widgets/images/full_image.widget.dart
index 77ea996b89..78fc0a6a21 100644
--- a/mobile/lib/presentation/widgets/images/full_image.widget.dart
+++ b/mobile/lib/presentation/widgets/images/full_image.widget.dart
@@ -22,7 +22,7 @@ class FullImage extends StatelessWidget {
Widget build(BuildContext context) {
final provider = getFullImageProvider(asset, size: size);
return OctoImage(
- fadeInDuration: const Duration(milliseconds: 0),
+ fadeInDuration: Duration.zero,
fadeOutDuration: const Duration(milliseconds: 100),
placeholderBuilder: placeholder != null ? (_) => placeholder! : null,
image: provider,
diff --git a/mobile/lib/presentation/widgets/images/image_provider.dart b/mobile/lib/presentation/widgets/images/image_provider.dart
index b3c58314db..9cc386e302 100644
--- a/mobile/lib/presentation/widgets/images/image_provider.dart
+++ b/mobile/lib/presentation/widgets/images/image_provider.dart
@@ -25,7 +25,7 @@ mixin CancellableImageProviderMixin<T extends Object> on CancellableImageProvide
ImageInfo? getInitialImage(CancellableImageProvider provider) {
final completer = CancelableCompleter<ImageInfo?>(onCancel: provider.cancel);
- final cachedStream = provider.resolve(const ImageConfiguration());
+ final cachedStream = provider.resolve(ImageConfiguration.empty);
ImageInfo? cachedImage;
final listener = ImageStreamListener((image, synchronousCall) {
if (synchronousCall) {
diff --git a/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart b/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart
index c42d365464..7d71f0296d 100644
--- a/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart
+++ b/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart
@@ -285,7 +285,7 @@ class _TileOverlayIcon extends StatelessWidget {
icon,
color: Colors.white,
size: 16,
- shadows: [const Shadow(blurRadius: 5.0, color: Color.fromRGBO(0, 0, 0, 0.6), offset: Offset(0.0, 0.0))],
+ shadows: const [Shadow(blurRadius: 5.0, color: Color.fromRGBO(0, 0, 0, 0.6), offset: Offset.zero)],
);
}
}
diff --git a/mobile/lib/presentation/widgets/map/map_utils.dart b/mobile/lib/presentation/widgets/map/map_utils.dart
index 80df5995b6..3ce7b2e055 100644
--- a/mobile/lib/presentation/widgets/map/map_utils.dart
+++ b/mobile/lib/presentation/widgets/map/map_utils.dart
@@ -71,7 +71,7 @@ class MapUtils {
bool silent = false,
}) async {
try {
- bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
+ final bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled && !silent) {
unawaited(showDialog(context: context, builder: (context) => _LocationServiceDisabledDialog(context)));
return (null, LocationPermission.deniedForever);
@@ -98,7 +98,7 @@ class MapUtils {
return (null, LocationPermission.deniedForever);
}
- Position currentUserLocation = await Geolocator.getCurrentPosition(
+ final Position currentUserLocation = await Geolocator.getCurrentPosition(
locationSettings: const LocationSettings(
accuracy: LocationAccuracy.high,
distanceFilter: 0,
diff --git a/mobile/lib/presentation/widgets/memory/memory_card.widget.dart b/mobile/lib/presentation/widgets/memory/memory_card.widget.dart
index 2f7a616632..2a88de8e0a 100644
--- a/mobile/lib/presentation/widgets/memory/memory_card.widget.dart
+++ b/mobile/lib/presentation/widgets/memory/memory_card.widget.dart
@@ -55,7 +55,7 @@ class DriftMemoryCard extends StatelessWidget {
}
if (asset.isImage) {
- return FullImage(asset, fit: fit, size: const Size(double.infinity, double.infinity));
+ return FullImage(asset, fit: fit, size: Size.infinite);
}
return Center(
diff --git a/mobile/lib/presentation/widgets/people/person_edit_birthday_modal.widget.dart b/mobile/lib/presentation/widgets/people/person_edit_birthday_modal.widget.dart
index c194bbc684..6e66ff47ce 100644
--- a/mobile/lib/presentation/widgets/people/person_edit_birthday_modal.widget.dart
+++ b/mobile/lib/presentation/widgets/people/person_edit_birthday_modal.widget.dart
@@ -6,9 +6,9 @@ import 'package:immich_mobile/domain/models/person.model.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
+import 'package:immich_mobile/utils/debug_print.dart';
import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:scroll_date_picker/scroll_date_picker.dart';
-import 'package:immich_mobile/utils/debug_print.dart';
class DriftPersonBirthdayEditForm extends ConsumerStatefulWidget {
final DriftPerson person;
@@ -28,7 +28,7 @@ class _DriftPersonNameEditFormState extends ConsumerState<DriftPersonBirthdayEdi
_selectedDate = widget.person.birthDate ?? DateTime(DateTime.now().year - 30, 1, 1);
}
- void saveBirthday() async {
+ Future<void> saveBirthday() async {
try {
final result = await ref.read(driftPeopleServiceProvider).updateBrithday(widget.person.id, _selectedDate);
diff --git a/mobile/lib/presentation/widgets/people/person_edit_name_modal.widget.dart b/mobile/lib/presentation/widgets/people/person_edit_name_modal.widget.dart
index 6de19000e0..2eaac2ebf5 100644
--- a/mobile/lib/presentation/widgets/people/person_edit_name_modal.widget.dart
+++ b/mobile/lib/presentation/widgets/people/person_edit_name_modal.widget.dart
@@ -6,8 +6,8 @@ import 'package:immich_mobile/domain/models/person.model.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/providers/infrastructure/people.provider.dart';
-import 'package:immich_mobile/widgets/common/immich_toast.dart';
import 'package:immich_mobile/utils/debug_print.dart';
+import 'package:immich_mobile/widgets/common/immich_toast.dart';
class DriftPersonNameEditForm extends ConsumerStatefulWidget {
final DriftPerson person;
@@ -27,7 +27,7 @@ class _DriftPersonNameEditFormState extends ConsumerState<DriftPersonNameEditFor
_formController = TextEditingController(text: widget.person.name);
}
- void onEdit(String personId, String newName) async {
+ Future<void> onEdit(String personId, String newName) async {
try {
final result = await ref.read(driftPeopleServiceProvider).updateName(personId, newName);
if (result != 0) {
diff --git a/mobile/lib/presentation/widgets/people/person_option_sheet.widget.dart b/mobile/lib/presentation/widgets/people/person_option_sheet.widget.dart
index b374d48417..b0ded02624 100644
--- a/mobile/lib/presentation/widgets/people/person_option_sheet.widget.dart
+++ b/mobile/lib/presentation/widgets/people/person_option_sheet.widget.dart
@@ -11,7 +11,7 @@ class PersonOptionSheet extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
- TextStyle textStyle = Theme.of(context).textTheme.bodyLarge!.copyWith(fontWeight: FontWeight.w600);
+ final TextStyle textStyle = Theme.of(context).textTheme.bodyLarge!.copyWith(fontWeight: FontWeight.w600);
return SafeArea(
child: Padding(
diff --git a/mobile/lib/presentation/widgets/timeline/header.widget.dart b/mobile/lib/presentation/widgets/timeline/header.widget.dart
index 3eff305251..d73d024efb 100644
--- a/mobile/lib/presentation/widgets/timeline/header.widget.dart
+++ b/mobile/lib/presentation/widgets/timeline/header.widget.dart
@@ -6,8 +6,8 @@ import 'package:immich_mobile/domain/models/timeline.model.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/theme_extensions.dart';
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
-import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
class TimelineHeader extends HookConsumerWidget {
diff --git a/mobile/lib/presentation/widgets/timeline/scrubber.widget.dart b/mobile/lib/presentation/widgets/timeline/scrubber.widget.dart
index 27f523a2a8..f5e3493a8e 100644
--- a/mobile/lib/presentation/widgets/timeline/scrubber.widget.dart
+++ b/mobile/lib/presentation/widgets/timeline/scrubber.widget.dart
@@ -590,7 +590,7 @@ class _SlideFadeTransition extends StatelessWidget {
animation: _animation,
builder: (context, child) => _animation.value == 0.0 ? const SizedBox() : child!,
child: SlideTransition(
- position: Tween(begin: const Offset(0.3, 0.0), end: const Offset(0.0, 0.0)).animate(_animation),
+ position: Tween(begin: const Offset(0.3, 0.0), end: Offset.zero).animate(_animation),
child: FadeTransition(opacity: _animation, child: _child),
),
);
diff --git a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart
index 20a4b4257e..5bd39deb8a 100644
--- a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart
+++ b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart
@@ -199,7 +199,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> with WidgetsBi
switch (event) {
case ScrollToTopEvent():
_scrollToTop();
- case ScrollToDateEvent scrollToDateEvent:
+ case final ScrollToDateEvent scrollToDateEvent:
_scrollToDate(scrollToDateEvent.date);
case TimelineReloadEvent():
setState(() {});
diff --git a/mobile/lib/providers/album/album_title.provider.dart b/mobile/lib/providers/album/album_title.provider.dart
index bf812a01d8..b38c2929fb 100644
--- a/mobile/lib/providers/album/album_title.provider.dart
+++ b/mobile/lib/providers/album/album_title.provider.dart
@@ -3,11 +3,11 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
class AlbumTitleNotifier extends StateNotifier<String> {
AlbumTitleNotifier() : super("");
- setAlbumTitle(String title) {
+ void setAlbumTitle(String title) {
state = title;
}
- clearAlbumTitle() {
+ void clearAlbumTitle() {
state = "";
}
}
diff --git a/mobile/lib/providers/app_life_cycle.provider.dart b/mobile/lib/providers/app_life_cycle.provider.dart
index ad0940b776..2b52973c0a 100644
--- a/mobile/lib/providers/app_life_cycle.provider.dart
+++ b/mobile/lib/providers/app_life_cycle.provider.dart
@@ -35,7 +35,7 @@ class AppLifeCycleNotifier extends StateNotifier<AppLifeCycleEnum> {
return state;
}
- void handleAppResume() async {
+ Future<void> handleAppResume() async {
state = AppLifeCycleEnum.resumed;
// Prevent overlapping resume operations
diff --git a/mobile/lib/providers/asset_viewer/download.provider.dart b/mobile/lib/providers/asset_viewer/download.provider.dart
index 37d3392d88..2c4854bdb0 100644
--- a/mobile/lib/providers/asset_viewer/download.provider.dart
+++ b/mobile/lib/providers/asset_viewer/download.provider.dart
@@ -37,7 +37,7 @@ class DownloadStateNotifier extends StateNotifier<DownloadState> {
);
}
- void cancelDownload(String id) async {
+ Future<void> cancelDownload(String id) async {
final isCanceled = await _downloadService.cancelDownload(id);
if (isCanceled) {
@@ -55,5 +55,5 @@ class DownloadStateNotifier extends StateNotifier<DownloadState> {
}
final downloadStateProvider = StateNotifierProvider<DownloadStateNotifier, DownloadState>(
- ((ref) => DownloadStateNotifier(ref.watch(downloadServiceProvider))),
+ (ref) => DownloadStateNotifier(ref.watch(downloadServiceProvider)),
);
diff --git a/mobile/lib/providers/asset_viewer/share_intent_upload.provider.dart b/mobile/lib/providers/asset_viewer/share_intent_upload.provider.dart
index 8bd0581061..51119f4ba2 100644
--- a/mobile/lib/providers/asset_viewer/share_intent_upload.provider.dart
+++ b/mobile/lib/providers/asset_viewer/share_intent_upload.provider.dart
@@ -9,11 +9,11 @@ import 'package:logging/logging.dart';
import 'package:path/path.dart' as p;
final shareIntentUploadProvider = StateNotifierProvider<ShareIntentUploadStateNotifier, List<ShareIntentAttachment>>(
- ((ref) => ShareIntentUploadStateNotifier(
+ (ref) => ShareIntentUploadStateNotifier(
ref.watch(appRouterProvider),
ref.read(foregroundUploadServiceProvider),
ref.read(shareIntentServiceProvider),
- )),
+ ),
);
class ShareIntentUploadStateNotifier extends StateNotifier<List<ShareIntentAttachment>> {
diff --git a/mobile/lib/providers/auth.provider.dart b/mobile/lib/providers/auth.provider.dart
index 23ccea8025..2ed4cbcf00 100644
--- a/mobile/lib/providers/auth.provider.dart
+++ b/mobile/lib/providers/auth.provider.dart
@@ -134,7 +134,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
await _widgetService.writeCredentials(serverEndpoint, accessToken, customHeaders);
// Get the deviceid from the store if it exists, otherwise generate a new one
- String deviceId = Store.tryGet(StoreKey.deviceId) ?? await FlutterUdid.consistentUdid;
+ final String deviceId = Store.tryGet(StoreKey.deviceId) ?? await FlutterUdid.consistentUdid;
UserDto? user = _userService.tryGetMyUser();
diff --git a/mobile/lib/providers/backup/drift_backup.provider.dart b/mobile/lib/providers/backup/drift_backup.provider.dart
index bf2b7cae4a..b43fec023c 100644
--- a/mobile/lib/providers/backup/drift_backup.provider.dart
+++ b/mobile/lib/providers/backup/drift_backup.provider.dart
@@ -2,16 +2,15 @@ import 'dart:async';
import 'package:collection/collection.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:logging/logging.dart';
-
import 'package:immich_mobile/constants/constants.dart';
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
-import 'package:immich_mobile/utils/upload_speed_calculator.dart';
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
-import 'package:immich_mobile/services/foreground_upload.service.dart';
import 'package:immich_mobile/services/background_upload.service.dart';
+import 'package:immich_mobile/services/foreground_upload.service.dart';
+import 'package:immich_mobile/utils/upload_speed_calculator.dart';
+import 'package:logging/logging.dart';
class EnqueueStatus {
final int enqueueCount;
diff --git a/mobile/lib/providers/cast.provider.dart b/mobile/lib/providers/cast.provider.dart
index b298514d67..943ac930ec 100644
--- a/mobile/lib/providers/cast.provider.dart
+++ b/mobile/lib/providers/cast.provider.dart
@@ -58,7 +58,6 @@ class CastNotifier extends StateNotifier<CastManagerState> {
switch (type) {
case CastDestinationType.googleCast:
await _gCastService.connect(device);
- break;
}
}
diff --git a/mobile/lib/providers/gallery_permission.provider.dart b/mobile/lib/providers/gallery_permission.provider.dart
index 6e4fc69926..315c67a214 100644
--- a/mobile/lib/providers/gallery_permission.provider.dart
+++ b/mobile/lib/providers/gallery_permission.provider.dart
@@ -12,7 +12,7 @@ class GalleryPermissionNotifier extends StateNotifier<PermissionStatus> {
getGalleryPermissionStatus();
}
- get hasPermission => state.isGranted || state.isLimited;
+ bool get hasPermission => state.isGranted || state.isLimited;
/// Requests the gallery permission
Future<PermissionStatus> requestGalleryPermission() async {
diff --git a/mobile/lib/providers/haptic_feedback.provider.dart b/mobile/lib/providers/haptic_feedback.provider.dart
index 711c6fa4e2..e1ce5c8d0d 100644
--- a/mobile/lib/providers/haptic_feedback.provider.dart
+++ b/mobile/lib/providers/haptic_feedback.provider.dart
@@ -13,31 +13,31 @@ class HapticNotifier extends StateNotifier<void> {
HapticNotifier(this._ref) : super(null);
- selectionClick() {
+ void selectionClick() {
if (_ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableHapticFeedback)) {
HapticFeedback.selectionClick();
}
}
- lightImpact() {
+ void lightImpact() {
if (_ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableHapticFeedback)) {
HapticFeedback.lightImpact();
}
}
- mediumImpact() {
+ void mediumImpact() {
if (_ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableHapticFeedback)) {
HapticFeedback.mediumImpact();
}
}
- heavyImpact() {
+ void heavyImpact() {
if (_ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableHapticFeedback)) {
HapticFeedback.heavyImpact();
}
}
- vibrate() {
+ void vibrate() {
if (_ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableHapticFeedback)) {
HapticFeedback.vibrate();
}
diff --git a/mobile/lib/providers/infrastructure/action.provider.dart b/mobile/lib/providers/infrastructure/action.provider.dart
index 52e2d9e0b9..7e08686078 100644
--- a/mobile/lib/providers/infrastructure/action.provider.dart
+++ b/mobile/lib/providers/infrastructure/action.provider.dart
@@ -110,7 +110,7 @@ class ActionNotifier extends Notifier<void> {
return switch (source) {
ActionSource.timeline => ref.read(multiSelectProvider).selectedAssets,
ActionSource.viewer => switch (ref.read(assetViewerProvider).currentAsset) {
- BaseAsset asset => {asset},
+ final BaseAsset asset => {asset},
null => const {},
},
};
@@ -273,7 +273,7 @@ class ActionNotifier extends Notifier<void> {
Future<ActionResult?> deleteLocal(ActionSource source, BuildContext context) async {
final assets = _getAssets(source);
- bool? backedUpOnly = assets.every((asset) => asset.storage == AssetState.merged)
+ final bool? backedUpOnly = assets.every((asset) => asset.storage == AssetState.merged)
? true
: await showDialog<bool>(
context: context,
diff --git a/mobile/lib/providers/infrastructure/timeline.provider.dart b/mobile/lib/providers/infrastructure/timeline.provider.dart
index a67b8dd822..e5ac1389e9 100644
--- a/mobile/lib/providers/infrastructure/timeline.provider.dart
+++ b/mobile/lib/providers/infrastructure/timeline.provider.dart
@@ -24,7 +24,7 @@ final timelineServiceProvider = Provider<TimelineService>(
},
// Empty dependencies to inform the framework that this provider
// might be used in a ProviderScope
- dependencies: [],
+ dependencies: const [],
);
final timelineFactoryProvider = Provider<TimelineFactory>(
diff --git a/mobile/lib/providers/local_auth.provider.dart b/mobile/lib/providers/local_auth.provider.dart
index 44fc5ad80c..d2860975bb 100644
--- a/mobile/lib/providers/local_auth.provider.dart
+++ b/mobile/lib/providers/local_auth.provider.dart
@@ -48,15 +48,12 @@ class LocalAuthNotifier extends StateNotifier<BiometricStatus> {
case "NotEnrolled":
_log.warning("User is not enrolled in biometrics");
errorMessage = "biometric_no_options".tr();
- break;
case "NotAvailable":
_log.warning("Biometric authentication is not available");
errorMessage = "biometric_not_available".tr();
- break;
case "LockedOut":
_log.warning("User is locked out of biometric authentication");
errorMessage = "biometric_locked_out".tr();
- break;
default:
_log.warning("Failed to authenticate with unknown reason");
errorMessage = 'failed_to_authenticate'.tr();
diff --git a/mobile/lib/providers/map/map_marker.provider.dart b/mobile/lib/providers/map/map_marker.provider.dart
index 38432eab6b..ab73f94c10 100644
--- a/mobile/lib/providers/map/map_marker.provider.dart
+++ b/mobile/lib/providers/map/map_marker.provider.dart
@@ -8,8 +8,8 @@ final mapMarkersProvider = FutureProvider.autoDispose<List<MapMarker>>((ref) asy
final mapState = ref.read(mapStateNotifierProvider);
DateTime? fileCreatedAfter;
bool? isFavorite;
- bool isIncludeArchived = mapState.includeArchived;
- bool isWithPartners = mapState.withPartners;
+ final bool isIncludeArchived = mapState.includeArchived;
+ final bool isWithPartners = mapState.withPartners;
if (mapState.relativeTime != 0) {
fileCreatedAfter = DateTime.now().subtract(Duration(days: mapState.relativeTime));
diff --git a/mobile/lib/providers/oauth.provider.dart b/mobile/lib/providers/oauth.provider.dart
index 14b3353943..fd39e0907d 100644
--- a/mobile/lib/providers/oauth.provider.dart
+++ b/mobile/lib/providers/oauth.provider.dart
@@ -1,5 +1,5 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:immich_mobile/services/oauth.service.dart';
import 'package:immich_mobile/providers/api.provider.dart';
+import 'package:immich_mobile/services/oauth.service.dart';
final oAuthServiceProvider = Provider((ref) => OAuthService(ref.watch(apiServiceProvider)));
diff --git a/mobile/lib/providers/server_info.provider.dart b/mobile/lib/providers/server_info.provider.dart
index 98300894f9..bf83b36f54 100644
--- a/mobile/lib/providers/server_info.provider.dart
+++ b/mobile/lib/providers/server_info.provider.dart
@@ -56,11 +56,11 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
}
}
- _checkServerVersionMismatch(ServerVersion serverVersion, {ServerVersion? latestVersion}) async {
+ Future<void> _checkServerVersionMismatch(ServerVersion serverVersion, {ServerVersion? latestVersion}) async {
state = state.copyWith(serverVersion: serverVersion, latestVersion: latestVersion);
- var packageInfo = await PackageInfo.fromPlatform();
- SemVer clientVersion = SemVer.fromString(packageInfo.version);
+ final packageInfo = await PackageInfo.fromPlatform();
+ final SemVer clientVersion = SemVer.fromString(packageInfo.version);
if (serverVersion < clientVersion || (latestVersion != null && serverVersion < latestVersion)) {
state = state.copyWith(versionStatus: VersionStatus.serverOutOfDate);
@@ -75,12 +75,12 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
state = state.copyWith(versionStatus: VersionStatus.upToDate);
}
- handleReleaseInfo(ServerVersion serverVersion, ServerVersion? latestVersion) {
+ void handleReleaseInfo(ServerVersion serverVersion, ServerVersion? latestVersion) {
// Update local server version
_checkServerVersionMismatch(serverVersion, latestVersion: latestVersion);
}
- getServerFeatures() async {
+ Future<void> getServerFeatures() async {
final serverFeatures = await _serverInfoService.getServerFeatures();
if (serverFeatures == null) {
return;
@@ -88,7 +88,7 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
state = state.copyWith(serverFeatures: serverFeatures);
}
- getServerConfig() async {
+ Future<void> getServerConfig() async {
final serverConfig = await _serverInfoService.getServerConfig();
if (serverConfig == null) {
return;
diff --git a/mobile/lib/providers/sync_status.provider.dart b/mobile/lib/providers/sync_status.provider.dart
index 8d7266abf7..b7d4f8bdc3 100644
--- a/mobile/lib/providers/sync_status.provider.dart
+++ b/mobile/lib/providers/sync_status.provider.dart
@@ -7,7 +7,7 @@ enum SyncStatus {
success,
error;
- localized() {
+ String localized() {
return switch (this) {
SyncStatus.idle => "idle".tr(),
SyncStatus.syncing => "running".tr(),
diff --git a/mobile/lib/providers/timeline/multiselect.provider.dart b/mobile/lib/providers/timeline/multiselect.provider.dart
index 10c8bb86b6..cb053e0041 100644
--- a/mobile/lib/providers/timeline/multiselect.provider.dart
+++ b/mobile/lib/providers/timeline/multiselect.provider.dart
@@ -102,7 +102,7 @@ class MultiSelectNotifier extends Notifier<MultiSelectState> {
}
/// Bucket bulk operations
- void selectBucket(int offset, int bucketCount) async {
+ Future<void> selectBucket(int offset, int bucketCount) async {
final assets = await _timelineService.loadAssets(offset, bucketCount);
final selectedAssets = state.selectedAssets.toSet();
@@ -111,7 +111,7 @@ class MultiSelectNotifier extends Notifier<MultiSelectState> {
state = state.copyWith(selectedAssets: selectedAssets);
}
- void deselectBucket(int offset, int bucketCount) async {
+ Future<void> deselectBucket(int offset, int bucketCount) async {
final assets = await _timelineService.loadAssets(offset, bucketCount);
final selectedAssets = state.selectedAssets.toSet();
@@ -120,7 +120,7 @@ class MultiSelectNotifier extends Notifier<MultiSelectState> {
state = state.copyWith(selectedAssets: selectedAssets);
}
- void toggleBucketSelection(int offset, int bucketCount) async {
+ Future<void> toggleBucketSelection(int offset, int bucketCount) async {
final assets = await _timelineService.loadAssets(offset, bucketCount);
toggleBucketSelectionByAssets(assets);
}
diff --git a/mobile/lib/providers/upload_profile_image.provider.dart b/mobile/lib/providers/upload_profile_image.provider.dart
index 77772b0205..5e7f7fc732 100644
--- a/mobile/lib/providers/upload_profile_image.provider.dart
+++ b/mobile/lib/providers/upload_profile_image.provider.dart
@@ -66,7 +66,7 @@ class UploadProfileImageNotifier extends StateNotifier<UploadProfileImageState>
Future<bool> upload(XFile file, {String? fileName}) async {
state = state.copyWith(status: UploadProfileStatus.loading);
- var profileImagePath = await _userService.createProfileImage(fileName ?? file.name, await file.readAsBytes());
+ final profileImagePath = await _userService.createProfileImage(fileName ?? file.name, await file.readAsBytes());
if (profileImagePath != null) {
dPrint(() => "Successfully upload profile image");
@@ -80,5 +80,5 @@ class UploadProfileImageNotifier extends StateNotifier<UploadProfileImageState>
}
final uploadProfileImageProvider = StateNotifierProvider<UploadProfileImageNotifier, UploadProfileImageState>(
- ((ref) => UploadProfileImageNotifier(ref.watch(userServiceProvider))),
+ (ref) => UploadProfileImageNotifier(ref.watch(userServiceProvider)),
);
diff --git a/mobile/lib/providers/user.provider.dart b/mobile/lib/providers/user.provider.dart
index 5a56b65793..622847b0c2 100644
--- a/mobile/lib/providers/user.provider.dart
+++ b/mobile/lib/providers/user.provider.dart
@@ -14,7 +14,7 @@ class CurrentUserProvider extends StateNotifier<UserDto?> {
final UserService _userService;
late final StreamSubscription<UserDto?> streamSub;
- refresh() async {
+ Future<void> refresh() async {
try {
await _userService.refreshMyUser();
} catch (_) {}
diff --git a/mobile/lib/providers/websocket.provider.dart b/mobile/lib/providers/websocket.provider.dart
index fa05f9a4cd..a7c08457af 100644
--- a/mobile/lib/providers/websocket.provider.dart
+++ b/mobile/lib/providers/websocket.provider.dart
@@ -71,7 +71,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
final endpoint = Uri.parse(Store.get(StoreKey.serverEndpoint));
dPrint(() => "Attempting to connect to websocket");
// Configure socket transports must be specified
- Socket socket = io(
+ final Socket socket = io(
endpoint.origin,
OptionBuilder()
.setPath("${endpoint.path}/socket.io")
@@ -107,7 +107,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
socket.on('on_config_update', _handleOnConfigUpdate);
socket.on('on_new_release', _handleReleaseUpdates);
} catch (e) {
- dPrint(() => "[WEBSOCKET] Catch Websocket Error - ${e.toString()}");
+ dPrint(() => "[WEBSOCKET] Catch Websocket Error - $e");
}
}
}
@@ -147,7 +147,7 @@ class WebsocketNotifier extends StateNotifier<WebsocketState> {
_ref.read(serverInfoProvider.notifier).getServerConfig();
}
- _handleReleaseUpdates(dynamic data) {
+ void _handleReleaseUpdates(dynamic data) {
// Json guard
if (data is! Map) {
return;
diff --git a/mobile/lib/repositories/asset_media.repository.dart b/mobile/lib/repositories/asset_media.repository.dart
index 4c9b6f6009..5bfb18a00f 100644
--- a/mobile/lib/repositories/asset_media.repository.dart
+++ b/mobile/lib/repositories/asset_media.repository.dart
@@ -37,9 +37,9 @@ class AssetMediaRepository {
Future<bool> _androidSupportsTrash() async {
if (Platform.isAndroid) {
- DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
- AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
- int sdkVersion = androidInfo.version.sdkInt;
+ final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
+ final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
+ final int sdkVersion = androidInfo.version.sdkInt;
return sdkVersion >= 31;
}
return false;
diff --git a/mobile/lib/repositories/auth_api.repository.dart b/mobile/lib/repositories/auth_api.repository.dart
index 05dc7f103a..447826b9aa 100644
--- a/mobile/lib/repositories/auth_api.repository.dart
+++ b/mobile/lib/repositories/auth_api.repository.dart
@@ -32,7 +32,7 @@ class AuthApiRepository extends ApiRepository {
await _apiService.authenticationApi.logout().timeout(const Duration(seconds: 7));
}
- _mapLoginReponse(LoginResponseDto dto) {
+ LoginResponse _mapLoginReponse(LoginResponseDto dto) {
return LoginResponse(
accessToken: dto.accessToken,
isAdmin: dto.isAdmin,
diff --git a/mobile/lib/repositories/drift_album_api_repository.dart b/mobile/lib/repositories/drift_album_api_repository.dart
index 3a654b7511..e0d4cc4632 100644
--- a/mobile/lib/repositories/drift_album_api_repository.dart
+++ b/mobile/lib/repositories/drift_album_api_repository.dart
@@ -36,7 +36,8 @@ class DriftAlbumApiRepository extends ApiRepository {
Future<({List<String> removed, List<String> failed})> removeAssets(String albumId, Iterable<String> assetIds) async {
final response = await checkNull(_api.removeAssetFromAlbum(albumId, BulkIdsDto(ids: assetIds.toList())));
- final List<String> removed = [], failed = [];
+ final List<String> removed = [];
+ final List<String> failed = [];
for (final dto in response) {
if (dto.success) {
removed.add(dto.id);
@@ -55,7 +56,8 @@ class DriftAlbumApiRepository extends ApiRepository {
final response = await checkNull(
_api.addAssetsToAlbum(albumId, BulkIdsDto(ids: assetIds.toList()), abortTrigger: abortTrigger),
);
- final List<String> added = [], failed = [];
+ final List<String> added = [];
+ final List<String> failed = [];
for (final dto in response) {
if (dto.success) {
added.add(dto.id);
diff --git a/mobile/lib/repositories/gcast.repository.dart b/mobile/lib/repositories/gcast.repository.dart
index db3e0f45d0..b8ffe79b04 100644
--- a/mobile/lib/repositories/gcast.repository.dart
+++ b/mobile/lib/repositories/gcast.repository.dart
@@ -1,7 +1,7 @@
import 'package:cast/device.dart';
+import 'package:cast/discovery_service.dart';
import 'package:cast/session.dart';
import 'package:cast/session_manager.dart';
-import 'package:cast/discovery_service.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
final gCastRepositoryProvider = Provider((_) {
diff --git a/mobile/lib/repositories/upload.repository.dart b/mobile/lib/repositories/upload.repository.dart
index 68522490d8..1ebc9825f4 100644
--- a/mobile/lib/repositories/upload.repository.dart
+++ b/mobile/lib/repositories/upload.repository.dart
@@ -4,13 +4,13 @@ import 'dart:io';
import 'package:background_downloader/background_downloader.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
+import 'package:http/http.dart';
import 'package:immich_mobile/constants/constants.dart';
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/entities/store.entity.dart';
import 'package:immich_mobile/infrastructure/repositories/network.repository.dart';
-import 'package:logging/logging.dart';
-import 'package:http/http.dart';
import 'package:immich_mobile/utils/debug_print.dart';
+import 'package:logging/logging.dart';
final uploadRepositoryProvider = Provider((ref) => UploadRepository());
@@ -144,7 +144,7 @@ class UploadRepository {
logger.warning("Upload $logContext was cancelled");
return UploadResult.cancelled();
} catch (error, stackTrace) {
- logger.warning("Error uploading $logContext: ${error.toString()}: $stackTrace");
+ logger.warning("Error uploading $logContext: $error: $stackTrace");
return UploadResult.error(errorMessage: error.toString());
}
}
diff --git a/mobile/lib/routing/duplicate_guard.dart b/mobile/lib/routing/duplicate_guard.dart
index c55c7318d0..bffe6064ee 100644
--- a/mobile/lib/routing/duplicate_guard.dart
+++ b/mobile/lib/routing/duplicate_guard.dart
@@ -5,7 +5,7 @@ import 'package:immich_mobile/utils/debug_print.dart';
class DuplicateGuard extends AutoRouteGuard {
const DuplicateGuard();
@override
- void onNavigation(NavigationResolver resolver, StackRouter router) async {
+ Future<void> onNavigation(NavigationResolver resolver, StackRouter router) async {
// Duplicate navigation
if (resolver.route.name == router.current.name) {
dPrint(() => 'DuplicateGuard: Preventing duplicate route navigation for ${resolver.route.name}');
diff --git a/mobile/lib/routing/locked_guard.dart b/mobile/lib/routing/locked_guard.dart
index 38484538e0..da0a025bca 100644
--- a/mobile/lib/routing/locked_guard.dart
+++ b/mobile/lib/routing/locked_guard.dart
@@ -21,7 +21,7 @@ class LockedGuard extends AutoRouteGuard {
LockedGuard(this._apiService, this._secureStorageService, this._localAuth);
@override
- void onNavigation(NavigationResolver resolver, StackRouter router) async {
+ Future<void> onNavigation(NavigationResolver resolver, StackRouter router) async {
final authStatus = await _apiService.authenticationApi.getAuthStatus();
if (authStatus == null) {
@@ -62,13 +62,10 @@ class LockedGuard extends AutoRouteGuard {
switch (error.code) {
case auth_error.notAvailable:
_log.severe("notAvailable: $error");
- break;
case auth_error.notEnrolled:
_log.severe("not enrolled");
- break;
default:
_log.severe("error");
- break;
}
resolver.next(false);
diff --git a/mobile/lib/routing/router.dart b/mobile/lib/routing/router.dart
index 34d29be945..ea33e4ba25 100644
--- a/mobile/lib/routing/router.dart
+++ b/mobile/lib/routing/router.dart
@@ -38,7 +38,6 @@ import 'package:immich_mobile/pages/share_intent/share_intent.page.dart';
import 'package:immich_mobile/presentation/pages/cleanup_preview.page.dart';
import 'package:immich_mobile/presentation/pages/dev/main_timeline.page.dart';
import 'package:immich_mobile/presentation/pages/dev/media_stat.page.dart';
-import 'package:immich_mobile/presentation/pages/feature_message/whats_new.page.dart';
import 'package:immich_mobile/presentation/pages/download_info.page.dart';
import 'package:immich_mobile/presentation/pages/drift_activities.page.dart';
import 'package:immich_mobile/presentation/pages/drift_album.page.dart';
@@ -66,6 +65,7 @@ import 'package:immich_mobile/presentation/pages/drift_trash.page.dart';
import 'package:immich_mobile/presentation/pages/drift_user_selection.page.dart';
import 'package:immich_mobile/presentation/pages/drift_video.page.dart';
import 'package:immich_mobile/presentation/pages/edit/drift_edit.page.dart';
+import 'package:immich_mobile/presentation/pages/feature_message/whats_new.page.dart';
import 'package:immich_mobile/presentation/pages/local_timeline.page.dart';
import 'package:immich_mobile/presentation/pages/profile/profile_picture_crop.page.dart';
import 'package:immich_mobile/presentation/pages/search/drift_search.page.dart';
diff --git a/mobile/lib/services/api.service.dart b/mobile/lib/services/api.service.dart
index ab05ffc18f..f5e4c5c33e 100644
--- a/mobile/lib/services/api.service.dart
+++ b/mobile/lib/services/api.service.dart
@@ -53,7 +53,7 @@ class ApiService {
_apiClient.client = NetworkRepository.client;
}
- setEndpoint(String endpoint) {
+ void setEndpoint(String endpoint) {
_apiClient.basePath = endpoint;
_apiClient.client = NetworkRepository.client;
usersApi = UsersApi(_apiClient);
@@ -118,7 +118,7 @@ class ApiService {
}
try {
- await setEndpoint(serverUrl);
+ setEndpoint(serverUrl);
await serverInfoApi.pingServer().timeout(const Duration(seconds: 5));
} on TimeoutException catch (_) {
return false;
@@ -155,7 +155,7 @@ class ApiService {
}
Future<void> setDeviceInfoHeader() async {
- DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
+ final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
if (Platform.isIOS) {
final iosInfo = await deviceInfoPlugin.iosInfo;
diff --git a/mobile/lib/services/auth.service.dart b/mobile/lib/services/auth.service.dart
index 0de22fd124..0e02c7b1b9 100644
--- a/mobile/lib/services/auth.service.dart
+++ b/mobile/lib/services/auth.service.dart
@@ -5,8 +5,8 @@ import 'package:immich_mobile/domain/models/settings_key.dart';
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/domain/utils/background_sync.dart';
import 'package:immich_mobile/entities/store.entity.dart';
-import 'package:immich_mobile/infrastructure/repositories/settings.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/network.repository.dart';
+import 'package:immich_mobile/infrastructure/repositories/settings.repository.dart';
import 'package:immich_mobile/models/auth/auxilary_endpoint.model.dart';
import 'package:immich_mobile/models/auth/login_response.model.dart';
import 'package:immich_mobile/providers/api.provider.dart';
diff --git a/mobile/lib/services/background_upload.service.dart b/mobile/lib/services/background_upload.service.dart
index ec731c6f68..5b379ff890 100644
--- a/mobile/lib/services/background_upload.service.dart
+++ b/mobile/lib/services/background_upload.service.dart
@@ -171,7 +171,7 @@ class BackgroundUploadService {
const batchSize = 100;
final batch = candidates.take(batchSize).toList();
- List<UploadTask> tasks = [];
+ final List<UploadTask> tasks = [];
for (final asset in batch) {
final task = await getUploadTask(asset);
@@ -205,7 +205,7 @@ class BackgroundUploadService {
return _uploadRepository.start();
}
- void _handleTaskStatusUpdate(TaskStatusUpdate update) async {
+ Future<void> _handleTaskStatusUpdate(TaskStatusUpdate update) async {
switch (update.status) {
case TaskStatus.complete:
unawaited(_handleLivePhoto(update));
@@ -219,8 +219,6 @@ class BackgroundUploadService {
}
}
- break;
-
default:
break;
}
@@ -295,7 +293,7 @@ class BackgroundUploadService {
final extension = p.extension(file.path).isNotEmpty ? p.extension(file.path) : p.extension(asset.name);
final originalFileName = p.setExtension(fileName, extension);
- String metadata = UploadTaskMetadata(
+ final String metadata = UploadTaskMetadata(
localAssetId: asset.id,
isLivePhotos: entity.isLivePhoto,
livePhotoVideoId: '',
diff --git a/mobile/lib/services/download.service.dart b/mobile/lib/services/download.service.dart
index b84d6ebfe8..de8e8af3f5 100644
--- a/mobile/lib/services/download.service.dart
+++ b/mobile/lib/services/download.service.dart
@@ -63,7 +63,7 @@ class DownloadService {
onVideoDownloadStatus?.call(update);
}
- void _onLivePhotoRecordComplete(TaskRecord record) async {
+ Future<void> _onLivePhotoRecordComplete(TaskRecord record) async {
final livePhotosId = LivePhotosMetadata.fromJson(record.task.metaData).id;
await _saveLivePhotos(livePhotosId);
}
diff --git a/mobile/lib/services/folder.service.dart b/mobile/lib/services/folder.service.dart
index 543c7231d6..011acbe869 100644
--- a/mobile/lib/services/folder.service.dart
+++ b/mobile/lib/services/folder.service.dart
@@ -18,7 +18,7 @@ class FolderService {
final paths = await _folderApiRepository.getAllUniquePaths();
// Create folder structure
- Map<String, List<RecursiveFolder>> folderMap = {};
+ final Map<String, List<RecursiveFolder>> folderMap = {};
for (String fullPath in paths) {
if (fullPath == '/') {
@@ -30,12 +30,12 @@ class FolderService {
fullPath = '/$fullPath';
}
- List<String> segments = fullPath.split('/')..removeWhere((s) => s.isEmpty);
+ final List<String> segments = fullPath.split('/')..removeWhere((s) => s.isEmpty);
String currentPath = '';
for (int i = 0; i < segments.length; i++) {
- String parentPath = currentPath.isEmpty ? '_root_' : currentPath;
+ final String parentPath = currentPath.isEmpty ? '_root_' : currentPath;
currentPath = i == 0 ? '/${segments[i]}' : '$currentPath/${segments[i]}';
if (!folderMap.containsKey(parentPath)) {
@@ -55,7 +55,7 @@ class FolderService {
}
void attachSubfolders(RecursiveFolder folder) {
- String fullPath = folder.path.isEmpty ? '/${folder.name}' : '${folder.path}/${folder.name}';
+ final String fullPath = folder.path.isEmpty ? '/${folder.name}' : '${folder.path}/${folder.name}';
if (folderMap.containsKey(fullPath)) {
folder.subfolders.addAll(folderMap[fullPath]!);
@@ -67,7 +67,7 @@ class FolderService {
}
}
- List<RecursiveFolder> rootSubfolders = folderMap['_root_'] ?? [];
+ final List<RecursiveFolder> rootSubfolders = folderMap['_root_'] ?? [];
// Sort root subfolders based on order parameter
rootSubfolders.sort((a, b) => order == SortOrder.desc ? b.name.compareTo(a.name) : a.name.compareTo(b.name));
@@ -83,7 +83,7 @@ class FolderService {
if (folder is RecursiveFolder) {
String fullPath = folder.path.isEmpty ? folder.name : '${folder.path}/${folder.name}';
fullPath = fullPath[0] == '/' ? fullPath.substring(1) : fullPath;
- var result = await _folderApiRepository.getAssetsForPath(fullPath);
+ final result = await _folderApiRepository.getAssetsForPath(fullPath);
if (order == SortOrder.desc) {
result.sort((a, b) => b.createdAt.compareTo(a.createdAt));
diff --git a/mobile/lib/services/foreground_upload.service.dart b/mobile/lib/services/foreground_upload.service.dart
index cce1241473..7c0352a00e 100644
--- a/mobile/lib/services/foreground_upload.service.dart
+++ b/mobile/lib/services/foreground_upload.service.dart
@@ -398,7 +398,7 @@ class ForegroundUploadService {
}
}
} catch (error, stackTrace) {
- _logger.severe(() => "Error backup asset: ${error.toString()}", stackTrace);
+ _logger.severe(() => "Error backup asset: $error", stackTrace);
callbacks.onError?.call(asset.localId!, error.toString());
} finally {
if (Platform.isIOS) {
@@ -406,7 +406,7 @@ class ForegroundUploadService {
await file?.delete();
await livePhotoFile?.delete();
} catch (error, stackTrace) {
- _logger.severe(() => "ERROR deleting file: ${error.toString()}", stackTrace);
+ _logger.severe(() => "ERROR deleting file: $error", stackTrace);
}
}
}
diff --git a/mobile/lib/services/gcast.service.dart b/mobile/lib/services/gcast.service.dart
index dcf7685237..d9fc44a34d 100644
--- a/mobile/lib/services/gcast.service.dart
+++ b/mobile/lib/services/gcast.service.dart
@@ -62,7 +62,6 @@ class GCastService {
switch (message['type']) {
case "MEDIA_STATUS":
_handleMediaStatus(message);
- break;
}
}
@@ -77,13 +76,10 @@ class GCastService {
switch (status['playerState']) {
case "PLAYING":
onCastState?.call(CastState.playing);
- break;
case "PAUSED":
onCastState?.call(CastState.paused);
- break;
case "BUFFERING":
onCastState?.call(CastState.buffering);
- break;
case "IDLE":
onCastState?.call(CastState.idle);
@@ -91,8 +87,6 @@ class GCastService {
if (status["idleReason"] == "FINISHED") {
_mediaStatusPollingTimer?.cancel();
}
-
- break;
}
if (status["media"] != null && status["media"]["duration"] != null) {
@@ -147,7 +141,7 @@ class GCastService {
return bufferedExpiration.isAfter(DateTime.now());
}
- void loadMedia(RemoteAsset asset, bool reload) async {
+ Future<void> loadMedia(RemoteAsset asset, bool reload) async {
if (!isConnected) {
return;
} else if (asset.id == currentAssetId && !reload) {
diff --git a/mobile/lib/services/search.service.dart b/mobile/lib/services/search.service.dart
index 0330c8485c..e64c529f26 100644
--- a/mobile/lib/services/search.service.dart
+++ b/mobile/lib/services/search.service.dart
@@ -34,7 +34,7 @@ class SearchService {
model: model,
);
} catch (e) {
- dPrint(() => "[ERROR] [getSearchSuggestions] ${e.toString()}");
+ dPrint(() => "[ERROR] [getSearchSuggestions] $e");
return [];
}
}
diff --git a/mobile/lib/services/server_info.service.dart b/mobile/lib/services/server_info.service.dart
index 460e135421..fb8b347caa 100644
--- a/mobile/lib/services/server_info.service.dart
+++ b/mobile/lib/services/server_info.service.dart
@@ -21,7 +21,7 @@ class ServerInfoService {
return ServerDiskInfo.fromDto(dto);
}
} catch (e) {
- dPrint(() => "Error [getDiskInfo] ${e.toString()}");
+ dPrint(() => "Error [getDiskInfo] $e");
}
return null;
}
@@ -33,7 +33,7 @@ class ServerInfoService {
return ServerVersion.fromDto(dto);
}
} catch (e) {
- dPrint(() => "Error [getServerVersion] ${e.toString()}");
+ dPrint(() => "Error [getServerVersion] $e");
}
return null;
}
@@ -45,7 +45,7 @@ class ServerInfoService {
return ServerFeatures.fromDto(dto);
}
} catch (e) {
- dPrint(() => "Error [getServerFeatures] ${e.toString()}");
+ dPrint(() => "Error [getServerFeatures] $e");
}
return null;
}
@@ -57,7 +57,7 @@ class ServerInfoService {
return ServerConfig.fromDto(dto);
}
} catch (e) {
- dPrint(() => "Error [getServerConfig] ${e.toString()}");
+ dPrint(() => "Error [getServerConfig] $e");
}
return null;
}
diff --git a/mobile/lib/theme/dynamic_theme.dart b/mobile/lib/theme/dynamic_theme.dart
index 7f7c4d05d7..088679b508 100644
--- a/mobile/lib/theme/dynamic_theme.dart
+++ b/mobile/lib/theme/dynamic_theme.dart
@@ -1,6 +1,5 @@
-import 'package:flutter/material.dart';
import 'package:dynamic_color/dynamic_color.dart';
-
+import 'package:flutter/material.dart';
import 'package:immich_mobile/theme/theme_data.dart';
import 'package:immich_mobile/utils/debug_print.dart';
diff --git a/mobile/lib/utils/bytes_units.dart b/mobile/lib/utils/bytes_units.dart
index 5eb15221fe..2c5c5f18a9 100644
--- a/mobile/lib/utils/bytes_units.dart
+++ b/mobile/lib/utils/bytes_units.dart
@@ -22,6 +22,6 @@ String formatHumanReadableBytes(int bytes, int decimals) {
return "0 B";
}
const suffixes = ["B", "KiB", "MiB", "GiB", "TiB"];
- var i = (log(bytes) / log(1024)).floor();
+ final i = (log(bytes) / log(1024)).floor();
return '${(bytes / pow(1024, i)).toStringAsFixed(decimals)} ${suffixes[i]}';
}
diff --git a/mobile/lib/utils/diff.dart b/mobile/lib/utils/diff.dart
index ea20de16cc..fae3a5d516 100644
--- a/mobile/lib/utils/diff.dart
+++ b/mobile/lib/utils/diff.dart
@@ -16,7 +16,8 @@ Future<bool> diffSortedLists<T>(
assert(la.isSorted(compare), "first argument must be sorted");
assert(lb.isSorted(compare), "second argument must be sorted");
bool diff = false;
- int i = 0, j = 0;
+ int i = 0;
+ int j = 0;
for (; i < la.length && j < lb.length;) {
final int order = compare(la[i], lb[j]);
if (order == 0) {
@@ -53,7 +54,8 @@ bool diffSortedListsSync<T>(
assert(la.isSorted(compare), "first argument must be sorted");
assert(lb.isSorted(compare), "second argument must be sorted");
bool diff = false;
- int i = 0, j = 0;
+ int i = 0;
+ int j = 0;
for (; i < la.length && j < lb.length;) {
final int order = compare(la[i], lb[j]);
if (order == 0) {
diff --git a/mobile/lib/utils/editor.utils.dart b/mobile/lib/utils/editor.utils.dart
index fa2dedf383..c3440cce1a 100644
--- a/mobile/lib/utils/editor.utils.dart
+++ b/mobile/lib/utils/editor.utils.dart
@@ -50,10 +50,10 @@ typedef NormalizedTransform = ({double rotation, bool mirrorHorizontal, bool mir
NormalizedTransform normalizeTransformEdits(List<AssetEdit> edits) {
final matrix = buildAffineFromEdits(edits);
- double a = matrix.a;
- double b = matrix.b;
- double c = matrix.c;
- double d = matrix.d;
+ final double a = matrix.a;
+ final double b = matrix.b;
+ final double c = matrix.c;
+ final double d = matrix.d;
final rotation = ((isCloseToZero(a) ? asin(c) : acos(a)) * 180) / pi;
diff --git a/mobile/lib/utils/error_handler.dart b/mobile/lib/utils/error_handler.dart
index d82e480575..dcac1431ab 100644
--- a/mobile/lib/utils/error_handler.dart
+++ b/mobile/lib/utils/error_handler.dart
@@ -24,7 +24,7 @@ void handleError(Object error, {StackTrace? stack, String? description}) {
);
final String message;
- if (serverErrorMessage(error) case String serverMessage) {
+ if (serverErrorMessage(error) case final String serverMessage) {
message = serverMessage;
} else if (isConnectionError(error)) {
message = StaticTranslations.instance.login_form_server_error;
diff --git a/mobile/lib/utils/hooks/crop_controller_hook.dart b/mobile/lib/utils/hooks/crop_controller_hook.dart
index 663bca3dbf..cea901bd2e 100644
--- a/mobile/lib/utils/hooks/crop_controller_hook.dart
+++ b/mobile/lib/utils/hooks/crop_controller_hook.dart
@@ -1,7 +1,8 @@
-import 'package:flutter_hooks/flutter_hooks.dart';
-import 'package:crop_image/crop_image.dart';
import 'dart:ui'; // Import the dart:ui library for Rect
+import 'package:crop_image/crop_image.dart';
+import 'package:flutter_hooks/flutter_hooks.dart';
+
/// A hook that provides a [CropController] instance.
CropController useCropController() {
return useMemoized(() => CropController(defaultCrop: const Rect.fromLTRB(0, 0, 1, 1)));
diff --git a/mobile/lib/utils/image_converter.dart b/mobile/lib/utils/image_converter.dart
index 6711e2bd56..d0fd4f873f 100644
--- a/mobile/lib/utils/image_converter.dart
+++ b/mobile/lib/utils/image_converter.dart
@@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
Future<Uint8List> imageToUint8List(Image image) async {
final Completer<Uint8List> completer = Completer();
image.image
- .resolve(const ImageConfiguration())
+ .resolve(ImageConfiguration.empty)
.addListener(
ImageStreamListener((ImageInfo info, bool _) {
info.image.toByteData(format: ImageByteFormat.png).then((byteData) {
diff --git a/mobile/lib/utils/image_url_builder.dart b/mobile/lib/utils/image_url_builder.dart
index 7a7ee03f2b..4f584061d7 100644
--- a/mobile/lib/utils/image_url_builder.dart
+++ b/mobile/lib/utils/image_url_builder.dart
@@ -12,7 +12,7 @@ String getThumbnailUrlForRemoteId(
bool edited = true,
String? thumbhash,
}) {
- final url = '${Store.get(StoreKey.serverEndpoint)}/assets/$id/thumbnail?size=${type.toString()}&edited=$edited';
+ final url = '${Store.get(StoreKey.serverEndpoint)}/assets/$id/thumbnail?size=$type&edited=$edited';
return thumbhash != null ? '$url&c=${Uri.encodeComponent(thumbhash)}' : url;
}
diff --git a/mobile/lib/utils/map_utils.dart b/mobile/lib/utils/map_utils.dart
index 6213b214a9..19c66e51e9 100644
--- a/mobile/lib/utils/map_utils.dart
+++ b/mobile/lib/utils/map_utils.dart
@@ -68,7 +68,7 @@ class MapUtils {
bool silent = false,
}) async {
try {
- bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
+ final bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled && !silent) {
unawaited(showDialog(context: context, builder: (context) => _LocationServiceDisabledDialog()));
return (null, LocationPermission.deniedForever);
@@ -95,7 +95,7 @@ class MapUtils {
return (null, LocationPermission.deniedForever);
}
- Position currentUserLocation = await Geolocator.getCurrentPosition(
+ final Position currentUserLocation = await Geolocator.getCurrentPosition(
locationSettings: const LocationSettings(
accuracy: LocationAccuracy.high,
distanceFilter: 0,
diff --git a/mobile/lib/utils/openapi_patching.dart b/mobile/lib/utils/openapi_patching.dart
index 711a4a3163..e92b2afd12 100644
--- a/mobile/lib/utils/openapi_patching.dart
+++ b/mobile/lib/utils/openapi_patching.dart
@@ -56,9 +56,9 @@ void upgradeDto(dynamic value, String targetType) {
});
}
-addDefault(dynamic value, String keys, dynamic defaultValue) {
+void addDefault(dynamic value, String keys, dynamic defaultValue) {
// Loop through the keys and assign the default value if the key is not present
- List<String> keyList = keys.split('.');
+ final List<String> keyList = keys.split('.');
dynamic current = value;
for (int i = 0; i < keyList.length - 1; i++) {
diff --git a/mobile/lib/utils/people.utils.dart b/mobile/lib/utils/people.utils.dart
index ddd1867269..18ae8a4528 100644
--- a/mobile/lib/utils/people.utils.dart
+++ b/mobile/lib/utils/people.utils.dart
@@ -5,8 +5,8 @@ import 'package:immich_mobile/presentation/widgets/people/person_edit_birthday_m
import 'package:immich_mobile/presentation/widgets/people/person_edit_name_modal.widget.dart';
String formatAge(DateTime birthDate, DateTime referenceDate) {
- int ageInYears = _calculateAge(birthDate, referenceDate);
- int ageInMonths = _calculateAgeInMonths(birthDate, referenceDate);
+ final int ageInYears = _calculateAge(birthDate, referenceDate);
+ final int ageInMonths = _calculateAgeInMonths(birthDate, referenceDate);
if (ageInMonths <= 11) {
return "person_age_months".t(args: {'months': ageInMonths.toString()});
diff --git a/mobile/lib/utils/timezone.dart b/mobile/lib/utils/timezone.dart
index 3e8c42d1b2..980d51de8e 100644
--- a/mobile/lib/utils/timezone.dart
+++ b/mobile/lib/utils/timezone.dart
@@ -21,7 +21,7 @@ import 'package:timezone/timezone.dart';
return (dt, dt.timeZoneOffset);
} on LocationNotFoundException {
// Handle UTC offset format (e.g., "UTC+08:00")
- RegExp re = RegExp(r'^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$', caseSensitive: false);
+ final RegExp re = RegExp(r'^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$', caseSensitive: false);
final m = re.firstMatch(timeZone);
if (m != null) {
final hours = int.parse(m.group(1) ?? '0');
diff --git a/mobile/lib/widgets/album/remote_album_shared_user_icons.dart b/mobile/lib/widgets/album/remote_album_shared_user_icons.dart
index 2025fa7583..be908259d4 100644
--- a/mobile/lib/widgets/album/remote_album_shared_user_icons.dart
+++ b/mobile/lib/widgets/album/remote_album_shared_user_icons.dart
@@ -30,12 +30,12 @@ class RemoteAlbumSharedUserIcons extends ConsumerWidget {
height: 50,
child: ListView.builder(
scrollDirection: Axis.horizontal,
- itemBuilder: ((context, index) {
+ itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(right: 4.0),
child: UserCircleAvatar(user: sharedUsers[index], size: 36, hasBorder: true),
);
- }),
+ },
itemCount: sharedUsers.length,
),
),
diff --git a/mobile/lib/widgets/asset_grid/thumbnail_placeholder.dart b/mobile/lib/widgets/asset_grid/thumbnail_placeholder.dart
index a84dfbae37..12105aa498 100644
--- a/mobile/lib/widgets/asset_grid/thumbnail_placeholder.dart
+++ b/mobile/lib/widgets/asset_grid/thumbnail_placeholder.dart
@@ -11,7 +11,7 @@ class ThumbnailPlaceholder extends StatelessWidget {
@override
Widget build(BuildContext context) {
- var gradientColors = [
+ final gradientColors = [
context.colorScheme.surfaceContainer,
context.colorScheme.surfaceContainer.darken(amount: .1),
];
diff --git a/mobile/lib/widgets/asset_viewer/detail_panel/exif_map.dart b/mobile/lib/widgets/asset_viewer/detail_panel/exif_map.dart
index f48ee06fdd..18bb27d024 100644
--- a/mobile/lib/widgets/asset_viewer/detail_panel/exif_map.dart
+++ b/mobile/lib/widgets/asset_viewer/detail_panel/exif_map.dart
@@ -39,7 +39,7 @@ class ExifMap extends StatelessWidget {
const zoomLevel = 16;
if (Platform.isAndroid) {
- Uri uri = Uri(
+ final Uri uri = Uri(
scheme: 'geo',
host: '$latitude,$longitude',
queryParameters: {'z': '$zoomLevel', 'q': '$latitude,$longitude'},
@@ -48,8 +48,8 @@ class ExifMap extends StatelessWidget {
return uri;
}
} else if (Platform.isIOS) {
- var params = {'ll': '$latitude,$longitude', 'q': '$latitude,$longitude', 'z': '$zoomLevel'};
- Uri uri = Uri.https('maps.apple.com', '/', params);
+ final params = {'ll': '$latitude,$longitude', 'q': '$latitude,$longitude', 'z': '$zoomLevel'};
+ final Uri uri = Uri.https('maps.apple.com', '/', params);
if (await canLaunchUrl(uri)) {
return uri;
}
@@ -73,7 +73,7 @@ class ExifMap extends StatelessWidget {
assetMarkerRemoteId: markerId,
assetThumbhash: markerAssetThumbhash,
onTap: (tapPosition, latLong) async {
- Uri? uri = await createCoordinatesUri();
+ final Uri? uri = await createCoordinatesUri();
if (uri == null) {
return;
diff --git a/mobile/lib/widgets/asset_viewer/video_controls.dart b/mobile/lib/widgets/asset_viewer/video_controls.dart
index 0f1e0e020d..f39077a522 100644
--- a/mobile/lib/widgets/asset_viewer/video_controls.dart
+++ b/mobile/lib/widgets/asset_viewer/video_controls.dart
@@ -4,11 +4,11 @@ import 'package:async/async.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/colors.dart';
+import 'package:immich_mobile/extensions/duration_extensions.dart';
import 'package:immich_mobile/models/cast/cast_manager_state.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/video_player_provider.dart';
import 'package:immich_mobile/providers/cast.provider.dart';
-import 'package:immich_mobile/extensions/duration_extensions.dart';
import 'package:immich_mobile/widgets/asset_viewer/animated_play_pause.dart';
class VideoControls extends ConsumerStatefulWidget {
diff --git a/mobile/lib/widgets/backup/drift_album_info_list_tile.dart b/mobile/lib/widgets/backup/drift_album_info_list_tile.dart
index 84128ddde2..85f655ec86 100644
--- a/mobile/lib/widgets/backup/drift_album_info_list_tile.dart
+++ b/mobile/lib/widgets/backup/drift_album_info_list_tile.dart
@@ -20,7 +20,7 @@ class DriftAlbumInfoListTile extends HookConsumerWidget {
final bool isSelected = album.backupSelection == BackupSelection.selected;
final bool isExcluded = album.backupSelection == BackupSelection.excluded;
- buildTileColor() {
+ Color? buildTileColor() {
if (isSelected) {
return context.isDarkTheme ? context.primaryColor.withAlpha(100) : context.primaryColor.withAlpha(25);
} else if (isExcluded) {
@@ -30,7 +30,7 @@ class DriftAlbumInfoListTile extends HookConsumerWidget {
}
}
- buildIcon() {
+ Icon buildIcon() {
if (isSelected) {
return Icon(Icons.check_circle_rounded, color: context.colorScheme.primary);
}
diff --git a/mobile/lib/widgets/common/app_bar_dialog/app_bar_dialog.dart b/mobile/lib/widgets/common/app_bar_dialog/app_bar_dialog.dart
index e77bc1869e..22c860becf 100644
--- a/mobile/lib/widgets/common/app_bar_dialog/app_bar_dialog.dart
+++ b/mobile/lib/widgets/common/app_bar_dialog/app_bar_dialog.dart
@@ -29,9 +29,9 @@ class ImmichAppBarDialog extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.watch(localeProvider);
- ServerDiskInfo backupState = ref.watch(backupProvider);
+ final ServerDiskInfo backupState = ref.watch(backupProvider);
final theme = context.themeData;
- bool isHorizontal = !context.isMobile;
+ final bool isHorizontal = !context.isMobile;
final horizontalPadding = isHorizontal ? 100.0 : 20.0;
final user = ref.watch(currentUserProvider);
final isLoggingOut = useState(false);
@@ -43,7 +43,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
return null;
}, []);
- buildTopRow() {
+ SizedBox buildTopRow() {
return SizedBox(
height: 56,
child: Stack(
@@ -68,7 +68,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
}
- buildActionButton(IconData icon, String text, Function() onTap, {Widget? trailing}) {
+ ListTile buildActionButton(IconData icon, String text, Function() onTap, {Widget? trailing}) {
return ListTile(
dense: true,
visualDensity: VisualDensity.standard,
@@ -84,11 +84,11 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
}
- buildSettingButton() {
+ ListTile buildSettingButton() {
return buildActionButton(Icons.settings_outlined, "settings", () => context.pushRoute(const SettingsRoute()));
}
- buildFreeUpSpaceButton() {
+ ListTile buildFreeUpSpaceButton() {
return buildActionButton(
Icons.cleaning_services_outlined,
"free_up_space",
@@ -96,7 +96,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
}
- buildAppLogButton() {
+ ListTile buildAppLogButton() {
return buildActionButton(
Icons.assignment_outlined,
"profile_drawer_app_logs",
@@ -104,7 +104,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
}
- buildSignOutButton() {
+ ListTile buildSignOutButton() {
return buildActionButton(
Icons.logout_rounded,
"sign_out",
@@ -171,7 +171,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
}
- buildFooter() {
+ Padding buildFooter() {
return Padding(
padding: const EdgeInsets.only(top: 10, bottom: 20),
child: Row(
@@ -213,7 +213,7 @@ class ImmichAppBarDialog extends HookConsumerWidget {
);
}
- buildReadonlyMessage() {
+ Padding buildReadonlyMessage() {
return Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: ListTile(
diff --git a/mobile/lib/widgets/common/app_bar_dialog/app_bar_profile_info.dart b/mobile/lib/widgets/common/app_bar_dialog/app_bar_profile_info.dart
index d6881f519a..c963564c69 100644
--- a/mobile/lib/widgets/common/app_bar_dialog/app_bar_profile_info.dart
+++ b/mobile/lib/widgets/common/app_bar_dialog/app_bar_profile_info.dart
@@ -24,7 +24,7 @@ class AppBarProfileInfoBox extends HookConsumerWidget {
final isReadonlyModeEnabled = ref.watch(readonlyModeProvider);
final user = ref.watch(currentUserProvider);
- buildUserProfileImage() {
+ Widget buildUserProfileImage() {
if (user == null) {
return const CircleAvatar(
radius: 20,
@@ -42,17 +42,17 @@ class AppBarProfileInfoBox extends HookConsumerWidget {
return userImage;
}
- pickUserProfileImage() async {
+ Future<void> pickUserProfileImage() async {
final XFile? image = await ImagePicker().pickImage(source: ImageSource.gallery, maxHeight: 1024, maxWidth: 1024);
if (image != null) {
- var success = await ref.watch(uploadProfileImageProvider.notifier).upload(image);
+ final success = await ref.watch(uploadProfileImageProvider.notifier).upload(image);
if (success) {
final profileImagePath = ref.read(uploadProfileImageProvider).profileImagePath;
ref.watch(authProvider.notifier).updateUserProfileImagePath(profileImagePath);
if (user != null) {
- ref.read(currentUserProvider.notifier).refresh();
+ unawaited(ref.read(currentUserProvider.notifier).refresh());
}
unawaited(ref.read(backupProvider.notifier).updateDiskInfo());
diff --git a/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart b/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart
index a209d280c3..fbec03bbbd 100644
--- a/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart
+++ b/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart
@@ -18,14 +18,14 @@ class AppBarServerInfo extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.watch(localeProvider);
- ServerInfo serverInfoState = ref.watch(serverInfoProvider);
+ final ServerInfo serverInfoState = ref.watch(serverInfoProvider);
final user = ref.watch(currentUserProvider);
final bool showVersionWarning = ref.watch(versionWarningPresentProvider(user));
final appInfo = useState({});
- getPackageInfo() async {
- PackageInfo packageInfo = await PackageInfo.fromPlatform();
+ Future<void> getPackageInfo() async {
+ final PackageInfo packageInfo = await PackageInfo.fromPlatform();
appInfo.value = {"version": packageInfo.version, "buildNumber": packageInfo.buildNumber};
}
diff --git a/mobile/lib/widgets/common/app_bar_dialog/server_update_notification.dart b/mobile/lib/widgets/common/app_bar_dialog/server_update_notification.dart
index 179eab8e7d..c29475351e 100644
--- a/mobile/lib/widgets/common/app_bar_dialog/server_update_notification.dart
+++ b/mobile/lib/widgets/common/app_bar_dialog/server_update_notification.dart
@@ -16,8 +16,10 @@ class ServerUpdateNotification extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final serverInfoState = ref.watch(serverInfoProvider);
- Color errorColor = const Color.fromARGB(85, 253, 97, 83);
- Color infoColor = context.isDarkTheme ? context.primaryColor.withAlpha(55) : context.primaryColor.withAlpha(25);
+ const Color errorColor = Color.fromARGB(85, 253, 97, 83);
+ final Color infoColor = context.isDarkTheme
+ ? context.primaryColor.withAlpha(55)
+ : context.primaryColor.withAlpha(25);
void openUpdateLink() {
String url;
if (serverInfoState.versionStatus == VersionStatus.serverOutOfDate) {
@@ -69,7 +71,7 @@ class ServerUpdateNotification extends HookConsumerWidget {
onPressed: openUpdateLink,
style: TextButton.styleFrom(
padding: const EdgeInsets.all(4),
- minimumSize: const Size(0, 0),
+ minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: serverInfoState.versionStatus == VersionStatus.clientOutOfDate
diff --git a/mobile/lib/widgets/common/date_time_picker.dart b/mobile/lib/widgets/common/date_time_picker.dart
index 0ebd7bba93..679241fc1b 100644
--- a/mobile/lib/widgets/common/date_time_picker.dart
+++ b/mobile/lib/widgets/common/date_time_picker.dart
@@ -41,7 +41,7 @@ class _DateTimePicker extends HookWidget {
}
}
- Duration? tzOffset = initialTZOffset ?? initialDateTime?.timeZoneOffset;
+ final Duration? tzOffset = initialTZOffset ?? initialDateTime?.timeZoneOffset;
if (tzOffset != null) {
final offsetInMilli = tzOffset.inMilliseconds;
@@ -80,7 +80,7 @@ class _DateTimePicker extends HookWidget {
)
.toList();
- void pickDate() async {
+ Future<void> pickDate() async {
final now = DateTime.now();
// Handles cases where the date from the asset is far off in the future
final initialDate = date.value.isAfter(now) ? now : date.value;
diff --git a/mobile/lib/widgets/common/immich_sliver_app_bar.dart b/mobile/lib/widgets/common/immich_sliver_app_bar.dart
index 6905b5b430..22528b05d5 100644
--- a/mobile/lib/widgets/common/immich_sliver_app_bar.dart
+++ b/mobile/lib/widgets/common/immich_sliver_app_bar.dart
@@ -10,8 +10,8 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/models/server_info/server_info.model.dart';
import 'package:immich_mobile/providers/backup/drift_backup.provider.dart';
import 'package:immich_mobile/providers/cast.provider.dart';
-import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/server_info.provider.dart';
import 'package:immich_mobile/providers/sync_status.provider.dart';
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
diff --git a/mobile/lib/widgets/common/immich_toast.dart b/mobile/lib/widgets/common/immich_toast.dart
index 1da07f419d..0a06de4d91 100644
--- a/mobile/lib/widgets/common/immich_toast.dart
+++ b/mobile/lib/widgets/common/immich_toast.dart
@@ -5,7 +5,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
enum ToastType { info, success, error }
class ImmichToast {
- static show({
+ static void show({
required BuildContext context,
required String msg,
ToastType toastType = ToastType.info,
diff --git a/mobile/lib/widgets/common/person_sliver_app_bar.dart b/mobile/lib/widgets/common/person_sliver_app_bar.dart
index a9f9413c47..80dded2130 100644
--- a/mobile/lib/widgets/common/person_sliver_app_bar.dart
+++ b/mobile/lib/widgets/common/person_sliver_app_bar.dart
@@ -13,11 +13,11 @@ import 'package:immich_mobile/domain/utils/event_stream.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/presentation/widgets/images/image_provider.dart';
-import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
import 'package:immich_mobile/presentation/widgets/images/remote_image_provider.dart';
+import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
import 'package:immich_mobile/providers/timeline/multiselect.provider.dart';
-import 'package:immich_mobile/utils/people.utils.dart';
import 'package:immich_mobile/utils/image_url_builder.dart';
+import 'package:immich_mobile/utils/people.utils.dart';
class PersonSliverAppBar extends ConsumerStatefulWidget {
const PersonSliverAppBar({
@@ -56,8 +56,8 @@ class _MesmerizingSliverAppBarState extends ConsumerState<PersonSliverAppBar> {
@override
Widget build(BuildContext context) {
final isMultiSelectEnabled = ref.watch(multiSelectProvider.select((s) => s.isEnabled));
- Color? actionIconColor = Color.lerp(Colors.white, context.primaryColor, _scrollProgress);
- List<Shadow> actionIconShadows = [
+ final Color? actionIconColor = Color.lerp(Colors.white, context.primaryColor, _scrollProgress);
+ final List<Shadow> actionIconShadows = [
if (_scrollProgress < 0.95)
Shadow(offset: const Offset(0, 2), blurRadius: 5, color: Colors.black.withValues(alpha: 0.5))
else
diff --git a/mobile/lib/widgets/common/remote_album_sliver_app_bar.dart b/mobile/lib/widgets/common/remote_album_sliver_app_bar.dart
index fee77dcd99..4d2dc5ef88 100644
--- a/mobile/lib/widgets/common/remote_album_sliver_app_bar.dart
+++ b/mobile/lib/widgets/common/remote_album_sliver_app_bar.dart
@@ -64,9 +64,9 @@ class _MesmerizingSliverAppBarState extends ConsumerState<RemoteAlbumSliverAppBa
return const SliverToBoxAdapter(child: SizedBox.shrink());
}
- Color? actionIconColor = Color.lerp(Colors.white, context.primaryColor, _scrollProgress);
+ final Color? actionIconColor = Color.lerp(Colors.white, context.primaryColor, _scrollProgress);
- List<Shadow> actionIconShadows = [
+ final List<Shadow> actionIconShadows = [
if (_scrollProgress < 0.95)
Shadow(offset: const Offset(0, 2), blurRadius: 5, color: Colors.black.withValues(alpha: 0.5))
else
diff --git a/mobile/lib/widgets/common/selection_sliver_app_bar.dart b/mobile/lib/widgets/common/selection_sliver_app_bar.dart
index ac74e69e64..d60124041c 100644
--- a/mobile/lib/widgets/common/selection_sliver_app_bar.dart
+++ b/mobile/lib/widgets/common/selection_sliver_app_bar.dart
@@ -23,7 +23,7 @@ class _SelectionSliverAppBarState extends ConsumerState<SelectionSliverAppBar> {
return !toExclude.contains(asset);
}).toSet();
- onDone(Set<BaseAsset> selected) {
+ void onDone(Set<BaseAsset> selected) {
ref.read(multiSelectProvider.notifier).reset();
context.pop<Set<BaseAsset>>(selected);
}
diff --git a/mobile/lib/widgets/common/tag_picker.dart b/mobile/lib/widgets/common/tag_picker.dart
index 0265cf7e6c..97fbff1930 100644
--- a/mobile/lib/widgets/common/tag_picker.dart
+++ b/mobile/lib/widgets/common/tag_picker.dart
@@ -1,5 +1,5 @@
-import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/tag.model.dart';
@@ -86,7 +86,7 @@ class TagPicker extends HookConsumerWidget {
final searchQuery = useState('');
final tags = ref.watch(tagProvider);
final selectedTagIds = useState<Set<String>>(filter);
- final borderRadius = const BorderRadius.all(Radius.circular(10));
+ const borderRadius = BorderRadius.all(Radius.circular(10));
final selectedNewTagValues = useState<Set<String>>({});
return Column(
diff --git a/mobile/lib/widgets/forms/change_password_form.dart b/mobile/lib/widgets/forms/change_password_form.dart
index 7ed9fa5f1c..7ab556b292 100644
--- a/mobile/lib/widgets/forms/change_password_form.dart
+++ b/mobile/lib/widgets/forms/change_password_form.dart
@@ -55,7 +55,7 @@ class ChangePasswordForm extends HookConsumerWidget {
passwordController: passwordController,
onPressed: () async {
if (formKey.currentState!.validate()) {
- var isSuccess = await ref
+ final isSuccess = await ref
.read(authProvider.notifier)
.changePassword(passwordController.value.text);
diff --git a/mobile/lib/widgets/forms/login/login_form.dart b/mobile/lib/widgets/forms/login/login_form.dart
index 79617f8fe4..4c9b56646f 100644
--- a/mobile/lib/widgets/forms/login/login_form.dart
+++ b/mobile/lib/widgets/forms/login/login_form.dart
@@ -76,7 +76,7 @@ class LoginForm extends HookConsumerWidget {
final loginFormKey = GlobalKey<FormState>();
final ValueNotifier<String?> serverEndpoint = useState<String?>(null);
- checkVersionMismatch() async {
+ Future<void> checkVersionMismatch() async {
try {
final packageInfo = await PackageInfo.fromPlatform();
final appSemVer = SemVer.fromString(packageInfo.version);
@@ -151,13 +151,13 @@ class LoginForm extends HookConsumerWidget {
return null;
}, []);
- populateTestLoginInfo() {
+ void populateTestLoginInfo() {
emailController.text = '[email protected]';
passwordController.text = 'demo';
serverEndpointController.text = 'https://demo.immich.app';
}
- populateTestLoginInfo1() {
+ void populateTestLoginInfo1() {
emailController.text = '[email protected]';
passwordController.text = 'password';
serverEndpointController.text = 'http://10.1.15.216:2283/api';
@@ -177,7 +177,7 @@ class LoginForm extends HookConsumerWidget {
}
}
- getManageMediaPermission() async {
+ Future<void> getManageMediaPermission() async {
final hasPermission = await ref.read(permissionRepositoryProvider).hasManageMediaPermission();
if (!hasPermission) {
await showDialog(
@@ -226,7 +226,7 @@ class LoginForm extends HookConsumerWidget {
bool isSyncRemoteDeletionsMode() => Platform.isAndroid && Store.get(StoreKey.manageLocalMediaAndroid, false);
- login() async {
+ Future<void> login() async {
TextInput.finishAutofillContext();
// Invalidate all api repository provider instance to take into account new access token
@@ -277,13 +277,13 @@ class LoginForm extends HookConsumerWidget {
}
Future<String> generatePKCECodeChallenge(String codeVerifier) async {
- var bytes = utf8.encode(codeVerifier);
- var digest = sha256.convert(bytes);
+ final bytes = utf8.encode(codeVerifier);
+ final digest = sha256.convert(bytes);
return base64Url.encode(digest.bytes).replaceAll('=', '');
}
- oAuthLogin() async {
- var oAuthService = ref.watch(oAuthServiceProvider);
+ Future<void> oAuthLogin() async {
+ final oAuthService = ref.watch(oAuthServiceProvider);
String? oAuthServerUrl;
final state = generateRandomString(32);
@@ -357,7 +357,7 @@ class LoginForm extends HookConsumerWidget {
}
}
- buildVersionCompatWarning() {
+ SingleChildRenderObjectWidget buildVersionCompatWarning() {
checkVersionMismatch();
if (warningMessage.value == null) {
diff --git a/mobile/lib/widgets/forms/pin_input.dart b/mobile/lib/widgets/forms/pin_input.dart
index c4f0d8f3b7..8bcfd51282 100644
--- a/mobile/lib/widgets/forms/pin_input.dart
+++ b/mobile/lib/widgets/forms/pin_input.dart
@@ -26,9 +26,9 @@ class PinInput extends StatelessWidget {
@override
Widget build(BuildContext context) {
- getPinSize() {
- final minimumPadding = 18.0;
- final gapWidth = 3.0;
+ Size getPinSize() {
+ const minimumPadding = 18.0;
+ const gapWidth = 3.0;
final screenWidth = context.width;
final pinWidth = (screenWidth - (minimumPadding * 2) - (gapWidth * 5)) / (length ?? 6);
diff --git a/mobile/lib/widgets/forms/pin_registration_form.dart b/mobile/lib/widgets/forms/pin_registration_form.dart
index d126169aad..b3270ec524 100644
--- a/mobile/lib/widgets/forms/pin_registration_form.dart
+++ b/mobile/lib/widgets/forms/pin_registration_form.dart
@@ -29,7 +29,7 @@ class PinRegistrationForm extends HookConsumerWidget {
return true;
}
- createNewPinCode() async {
+ Future<void> createNewPinCode() async {
final isValid = validatePinCode();
if (!isValid) {
hasError.value = true;
diff --git a/mobile/lib/widgets/forms/pin_verification_form.dart b/mobile/lib/widgets/forms/pin_verification_form.dart
index 2b7e3e8251..de2acaa1f7 100644
--- a/mobile/lib/widgets/forms/pin_verification_form.dart
+++ b/mobile/lib/widgets/forms/pin_verification_form.dart
@@ -29,7 +29,7 @@ class PinVerificationForm extends HookConsumerWidget {
final hasError = useState(false);
final isVerified = useState(false);
- verifyPin(String pinCode) async {
+ Future<void> verifyPin(String pinCode) async {
final isUnlocked = await ref.read(authProvider.notifier).unlockPinCode(pinCode);
if (isUnlocked) {
diff --git a/mobile/lib/widgets/map/asset_marker_icon.dart b/mobile/lib/widgets/map/asset_marker_icon.dart
index ff6058161b..75881195a4 100644
--- a/mobile/lib/widgets/map/asset_marker_icon.dart
+++ b/mobile/lib/widgets/map/asset_marker_icon.dart
@@ -69,15 +69,15 @@ class _PinPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
- Paint primaryBrush = Paint()
+ final Paint primaryBrush = Paint()
..color = primaryColor
..style = PaintingStyle.fill;
- Paint secondaryBrush = Paint()
+ final Paint secondaryBrush = Paint()
..color = secondaryColor
..style = PaintingStyle.fill;
- Paint lineBrush = Paint()
+ final Paint lineBrush = Paint()
..color = primaryColor
..style = PaintingStyle.stroke
..strokeWidth = 2;
diff --git a/mobile/lib/widgets/map/map_theme_override.dart b/mobile/lib/widgets/map/map_theme_override.dart
index 57f970b0d1..dda96efeaf 100644
--- a/mobile/lib/widgets/map/map_theme_override.dart
+++ b/mobile/lib/widgets/map/map_theme_override.dart
@@ -66,7 +66,7 @@ class _MapThemeOverrideState extends ConsumerState<MapThemeOverride> with Widget
@override
Widget build(BuildContext context) {
_theme = widget.themeMode ?? ref.watch(mapStateNotifierProvider.select((v) => v.themeMode));
- var appTheme = ref.watch(immichThemeProvider);
+ final appTheme = ref.watch(immichThemeProvider);
final locale = ref.watch(localeProvider);
useValueChanged<ThemeMode, void>(_theme, (_, __) {
diff --git a/mobile/lib/widgets/map/map_thumbnail.dart b/mobile/lib/widgets/map/map_thumbnail.dart
index 7defb52264..eb4653e17e 100644
--- a/mobile/lib/widgets/map/map_thumbnail.dart
+++ b/mobile/lib/widgets/map/map_thumbnail.dart
@@ -6,8 +6,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/asyncvalue_extensions.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/maplibrecontroller_extensions.dart';
-import 'package:immich_mobile/widgets/map/map_theme_override.dart';
import 'package:immich_mobile/widgets/map/asset_marker_icon.dart';
+import 'package:immich_mobile/widgets/map/map_theme_override.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
/// A non-interactive thumbnail of a map in the given coordinates with optional markers
diff --git a/mobile/lib/widgets/photo_view/src/core/photo_view_core.dart b/mobile/lib/widgets/photo_view/src/core/photo_view_core.dart
index 265feb756e..341decdbd6 100644
--- a/mobile/lib/widgets/photo_view/src/core/photo_view_core.dart
+++ b/mobile/lib/widgets/photo_view/src/core/photo_view_core.dart
@@ -1,15 +1,15 @@
import 'package:flutter/widgets.dart';
import 'package:immich_mobile/widgets/photo_view/photo_view.dart'
show
- PhotoViewScaleState,
PhotoViewHeroAttributes,
- PhotoViewImageTapDownCallback,
- PhotoViewImageTapUpCallback,
- PhotoViewImageScaleEndCallback,
PhotoViewImageDragEndCallback,
PhotoViewImageDragStartCallback,
PhotoViewImageDragUpdateCallback,
PhotoViewImageLongPressStartCallback,
+ PhotoViewImageScaleEndCallback,
+ PhotoViewImageTapDownCallback,
+ PhotoViewImageTapUpCallback,
+ PhotoViewScaleState,
ScaleStateCycle;
import 'package:immich_mobile/widgets/photo_view/src/controller/photo_view_controller.dart';
import 'package:immich_mobile/widgets/photo_view/src/controller/photo_view_controller_delegate.dart';
@@ -436,7 +436,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
? SizedBox(
width: scaleBoundaries.childSize.width * scale,
height: scaleBoundaries.childSize.height * scale,
- child: widget.customChild!,
+ child: widget.customChild,
)
: Image(
key: widget.heroAttributes?.tag != null ? ObjectKey(widget.heroAttributes!.tag) : null,
diff --git a/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart b/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart
index a9cfeb3a40..db66cb962d 100644
--- a/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart
+++ b/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart
@@ -75,7 +75,7 @@ class ImageWrapper extends StatefulWidget {
final int index;
@override
- createState() => _ImageWrapperState();
+ State<ImageWrapper> createState() => _ImageWrapperState();
}
class _ImageWrapperState extends State<ImageWrapper> {
@@ -122,7 +122,7 @@ class _ImageWrapperState extends State<ImageWrapper> {
// retrieve image from the provider
void _resolveImage() {
- final ImageStream newStream = widget.imageProvider.resolve(const ImageConfiguration());
+ final ImageStream newStream = widget.imageProvider.resolve(ImageConfiguration.empty);
_updateSourceStream(newStream);
}
@@ -135,7 +135,7 @@ class _ImageWrapperState extends State<ImageWrapper> {
}
void handleImageFrame(ImageInfo info, bool synchronousCall) {
- setupCB() {
+ void setupCB() {
_imageSize = Size(info.image.width.toDouble(), info.image.height.toDouble());
_loading = false;
_imageInfo = _imageInfo;
diff --git a/mobile/lib/widgets/search/search_filter/filter_bottom_sheet_scaffold.dart b/mobile/lib/widgets/search/search_filter/filter_bottom_sheet_scaffold.dart
index dee42ec5a0..1c338b8828 100644
--- a/mobile/lib/widgets/search/search_filter/filter_bottom_sheet_scaffold.dart
+++ b/mobile/lib/widgets/search/search_filter/filter_bottom_sheet_scaffold.dart
@@ -20,7 +20,7 @@ class FilterBottomSheetScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
- buildChildWidget() {
+ Widget buildChildWidget() {
if (expanded != null && expanded == true) {
return Expanded(child: child);
}
diff --git a/mobile/lib/widgets/search/search_filter/people_picker.dart b/mobile/lib/widgets/search/search_filter/people_picker.dart
index a9382ec3ae..0732b30a63 100644
--- a/mobile/lib/widgets/search/search_filter/people_picker.dart
+++ b/mobile/lib/widgets/search/search_filter/people_picker.dart
@@ -1,5 +1,5 @@
-import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/person.model.dart';
@@ -21,7 +21,7 @@ class PeoplePicker extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final formFocus = useFocusNode();
- final imageSize = 60.0;
+ const imageSize = 60.0;
final searchQuery = useState('');
final people = ref.watch(getAllPeopleProvider);
final selectedPeople = useState<Set<PersonDto>>(filter ?? {});
diff --git a/mobile/lib/widgets/search/search_filter/star_rating_picker.dart b/mobile/lib/widgets/search/search_filter/star_rating_picker.dart
index 32d1ab5bd4..864ddf2591 100644
--- a/mobile/lib/widgets/search/search_filter/star_rating_picker.dart
+++ b/mobile/lib/widgets/search/search_filter/star_rating_picker.dart
@@ -28,7 +28,7 @@ class StarRatingPicker extends HookWidget {
6,
(index) => RadioListTile<int>(
key: Key("star_$index"),
- title: Text('rating_count'.t(args: {'count': (index)})),
+ title: Text('rating_count'.t(args: {'count': index})),
value: index,
),
),
diff --git a/mobile/lib/widgets/search/thumbnail_with_info.dart b/mobile/lib/widgets/search/thumbnail_with_info.dart
index 7ba8257c8a..d25a324860 100644
--- a/mobile/lib/widgets/search/thumbnail_with_info.dart
+++ b/mobile/lib/widgets/search/thumbnail_with_info.dart
@@ -22,7 +22,7 @@ class ThumbnailWithInfo extends StatelessWidget {
@override
Widget build(BuildContext context) {
- var textAndIconColor = context.isDarkTheme ? Colors.grey[100] : Colors.grey[700];
+ final textAndIconColor = context.isDarkTheme ? Colors.grey[100] : Colors.grey[700];
return ThumbnailWithInfoContainer(
onTap: onTap,
borderRadius: borderRadius,
diff --git a/mobile/lib/widgets/settings/advanced_settings.dart b/mobile/lib/widgets/settings/advanced_settings.dart
index 542a7cc5e2..1c1d42639f 100644
--- a/mobile/lib/widgets/settings/advanced_settings.dart
+++ b/mobile/lib/widgets/settings/advanced_settings.dart
@@ -7,9 +7,9 @@ import 'package:flutter_hooks/flutter_hooks.dart' hide Store;
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/services/log.service.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
-import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/providers/infrastructure/platform.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
+import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
import 'package:immich_mobile/repositories/permission.repository.dart';
import 'package:immich_mobile/services/app_settings.service.dart';
import 'package:immich_mobile/utils/bytes_units.dart';
@@ -45,9 +45,9 @@ class AdvancedSettings extends HookConsumerWidget {
Future<bool> checkAndroidVersion() async {
if (Platform.isAndroid) {
- DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
- AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
- int sdkVersion = androidInfo.version.sdkInt;
+ final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
+ final AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
+ final int sdkVersion = androidInfo.version.sdkInt;
return sdkVersion >= 31;
}
return false;
diff --git a/mobile/lib/widgets/settings/asset_viewer_settings/asset_viewer_settings.dart b/mobile/lib/widgets/settings/asset_viewer_settings/asset_viewer_settings.dart
index f3b9039b2b..25829327e0 100644
--- a/mobile/lib/widgets/settings/asset_viewer_settings/asset_viewer_settings.dart
+++ b/mobile/lib/widgets/settings/asset_viewer_settings/asset_viewer_settings.dart
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:immich_mobile/widgets/settings/asset_viewer_settings/image_viewer_quality_setting.dart';
import 'package:immich_mobile/widgets/settings/asset_viewer_settings/image_viewer_tap_to_navigate_setting.dart';
-import 'package:immich_mobile/widgets/settings/asset_viewer_settings/video_viewer_settings.dart';
import 'package:immich_mobile/widgets/settings/asset_viewer_settings/slideshow_settings.dart';
+import 'package:immich_mobile/widgets/settings/asset_viewer_settings/video_viewer_settings.dart';
import 'package:immich_mobile/widgets/settings/settings_sub_page_scaffold.dart';
class AssetViewerSettings extends StatelessWidget {
diff --git a/mobile/lib/widgets/settings/free_up_space_settings.dart b/mobile/lib/widgets/settings/free_up_space_settings.dart
index da14933997..7b16c2d67d 100644
--- a/mobile/lib/widgets/settings/free_up_space_settings.dart
+++ b/mobile/lib/widgets/settings/free_up_space_settings.dart
@@ -173,7 +173,7 @@ class _FreeUpSpaceSettingsState extends ConsumerState<FreeUpSpaceSettings> {
}
@override
- dispose() {
+ void dispose() {
super.dispose();
WakelockPlus.disable();
}
diff --git a/mobile/lib/widgets/settings/networking_settings/external_network_preference.dart b/mobile/lib/widgets/settings/networking_settings/external_network_preference.dart
index 8250ef438a..f3c2b6c97f 100644
--- a/mobile/lib/widgets/settings/networking_settings/external_network_preference.dart
+++ b/mobile/lib/widgets/settings/networking_settings/external_network_preference.dart
@@ -19,7 +19,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
final entries = useState([const AuxilaryEndpoint(url: '', status: AuxCheckStatus.unknown)]);
final canSave = useState(false);
- saveEndpointList() {
+ Future<void> saveEndpointList() {
canSave.value = entries.value.every((e) => e.status == AuxCheckStatus.valid);
final urls = entries.value
@@ -30,7 +30,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
return ref.read(settingsProvider).write(SettingsKey.networkExternalEndpointList, urls);
}
- updateValidationStatus(String url, int index, AuxCheckStatus status) async {
+ Future<void> updateValidationStatus(String url, int index, AuxCheckStatus status) async {
entries.value[index] = entries.value[index].copyWith(url: url, status: status);
await saveEndpointList();
@@ -39,7 +39,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
}
}
- handleReorder(int oldIndex, int newIndex) {
+ void handleReorder(int oldIndex, int newIndex) {
final entry = entries.value.removeAt(oldIndex);
entries.value.insert(newIndex, entry);
entries.value = [...entries.value];
@@ -47,7 +47,7 @@ class ExternalNetworkPreference extends HookConsumerWidget {
saveEndpointList();
}
- handleDismiss(int index) {
+ void handleDismiss(int index) {
entries.value = [...entries.value..removeAt(index)];
saveEndpointList();
diff --git a/mobile/lib/widgets/settings/networking_settings/local_network_preference.dart b/mobile/lib/widgets/settings/networking_settings/local_network_preference.dart
index 1d2b5eea0f..f8b6b087a3 100644
--- a/mobile/lib/widgets/settings/networking_settings/local_network_preference.dart
+++ b/mobile/lib/widgets/settings/networking_settings/local_network_preference.dart
@@ -62,17 +62,17 @@ class LocalNetworkPreference extends HookConsumerWidget {
return null;
}, []);
- saveWifiName(String wifiName) {
+ Future<void> saveWifiName(String wifiName) {
wifiNameText.value = wifiName;
return ref.read(authProvider.notifier).saveWifiName(wifiName);
}
- saveLocalEndpoint(String url) {
+ Future<void> saveLocalEndpoint(String url) {
localEndpointText.value = url;
return ref.read(authProvider.notifier).saveLocalEndpoint(url);
}
- handleEditWifiName() async {
+ Future<void> handleEditWifiName() async {
final wifiName = await _showEditDialog(context, "wifi_name".tr(), "your_wifi_name".tr(), wifiNameText.value);
if (wifiName != null) {
@@ -80,7 +80,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
}
}
- handleEditServerEndpoint() async {
+ Future<void> handleEditServerEndpoint() async {
final localEndpoint = await _showEditDialog(
context,
"server_endpoint".tr(),
@@ -94,7 +94,7 @@ class LocalNetworkPreference extends HookConsumerWidget {
}
}
- autofillCurrentNetwork() async {
+ Future<void> autofillCurrentNetwork() async {
final wifiName = await ref.read(networkProvider.notifier).getWifiName();
if (wifiName == null) {
diff --git a/mobile/lib/widgets/settings/notification_setting.dart b/mobile/lib/widgets/settings/notification_setting.dart
index 8b7c652925..ee2e15f52b 100644
--- a/mobile/lib/widgets/settings/notification_setting.dart
+++ b/mobile/lib/widgets/settings/notification_setting.dart
@@ -15,14 +15,14 @@ class NotificationSetting extends HookConsumerWidget {
final permissionService = ref.watch(notificationPermissionProvider);
final hasPermission = permissionService == PermissionStatus.granted;
- openAppNotificationSettings(BuildContext ctx) {
+ void openAppNotificationSettings(BuildContext ctx) {
ctx.pop();
openAppSettings();
}
// When permissions are permanently denied, you need to go to settings to
// allow them
- showPermissionsDialog() {
+ void showPermissionsDialog() {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
diff --git a/mobile/lib/widgets/settings/preference_settings/haptic_setting.dart b/mobile/lib/widgets/settings/preference_settings/haptic_setting.dart
index 5e745dd61d..bfdb0f065c 100644
--- a/mobile/lib/widgets/settings/preference_settings/haptic_setting.dart
+++ b/mobile/lib/widgets/settings/preference_settings/haptic_setting.dart
@@ -3,9 +3,9 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/translate_extensions.dart';
import 'package:immich_mobile/services/app_settings.service.dart';
+import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
import 'package:immich_mobile/widgets/settings/setting_group_title.dart';
import 'package:immich_mobile/widgets/settings/settings_switch_list_tile.dart';
-import 'package:immich_mobile/utils/hooks/app_settings_update_hook.dart';
class HapticSetting extends HookConsumerWidget {
const HapticSetting({super.key});
@@ -15,7 +15,7 @@ class HapticSetting extends HookConsumerWidget {
final hapticFeedbackSetting = useAppSettingsState(AppSettingsEnum.enableHapticFeedback);
final isHapticFeedbackEnabled = useValueNotifier(hapticFeedbackSetting.value);
- onHapticFeedbackChange(bool isEnabled) {
+ void onHapticFeedbackChange(bool isEnabled) {
hapticFeedbackSetting.value = isEnabled;
}
diff --git a/mobile/lib/widgets/settings/preference_settings/primary_color_setting.dart b/mobile/lib/widgets/settings/preference_settings/primary_color_setting.dart
index 48d0ca672b..3fead2c59f 100644
--- a/mobile/lib/widgets/settings/preference_settings/primary_color_setting.dart
+++ b/mobile/lib/widgets/settings/preference_settings/primary_color_setting.dart
@@ -25,12 +25,12 @@ class PrimaryColorSetting extends HookConsumerWidget {
});
}
- onUseSystemColorChange(bool newValue) {
+ void onUseSystemColorChange(bool newValue) {
ref.read(settingsProvider).write(.themeDynamic, newValue);
popBottomSheet();
}
- onPrimaryColorChange(ImmichColorPreset colorPreset) {
+ void onPrimaryColorChange(ImmichColorPreset colorPreset) {
ref.read(settingsProvider).write(.themePrimaryColor, colorPreset);
//turn off system color setting
@@ -40,7 +40,7 @@ class PrimaryColorSetting extends HookConsumerWidget {
popBottomSheet();
}
- buildPrimaryColorTile({
+ Container buildPrimaryColorTile({
required Color topColor,
required Color bottomColor,
required double tileSize,
@@ -85,7 +85,7 @@ class PrimaryColorSetting extends HookConsumerWidget {
);
}
- bottomSheetContent() {
+ Column bottomSheetContent() {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
diff --git a/mobile/lib/widgets/settings/settings_switch_list_tile.dart b/mobile/lib/widgets/settings/settings_switch_list_tile.dart
index d8ed3ac017..4d358fa2b6 100644
--- a/mobile/lib/widgets/settings/settings_switch_list_tile.dart
+++ b/mobile/lib/widgets/settings/settings_switch_list_tile.dart
@@ -44,7 +44,7 @@ class SettingsSwitchListTile extends StatelessWidget {
onChanged: onSwitchChanged,
activeThumbColor: enabled ? context.primaryColor : context.themeData.disabledColor,
dense: true,
- secondary: icon != null ? Icon(icon!, color: valueNotifier.value ? context.primaryColor : null) : null,
+ secondary: icon != null ? Icon(icon, color: valueNotifier.value ? context.primaryColor : null) : null,
title: Text(
title,
style:
diff --git a/mobile/packages/ui/lib/src/components/password_input.dart b/mobile/packages/ui/lib/src/components/password_input.dart
index e99e9730a8..d08b3de99d 100644
--- a/mobile/packages/ui/lib/src/components/password_input.dart
+++ b/mobile/packages/ui/lib/src/components/password_input.dart
@@ -51,7 +51,7 @@ class _ImmichPasswordInputState extends State<ImmichPasswordInput> {
onPressed: _toggleVisibility,
icon: Icon(_visible ? Icons.visibility_off_rounded : Icons.visibility_rounded),
),
- autofillHints: [AutofillHints.password],
+ autofillHints: const [AutofillHints.password],
);
}
}
diff --git a/mobile/test/domain/services/sync_stream_service_test.dart b/mobile/test/domain/services/sync_stream_service_test.dart
index e033229408..ac81513d96 100644
--- a/mobile/test/domain/services/sync_stream_service_test.dart
+++ b/mobile/test/domain/services/sync_stream_service_test.dart
@@ -70,7 +70,7 @@ void main() {
await db.close();
});
- successHandler(Invocation _) async => true;
+ Future<bool> successHandler(Invocation _) async => true;
setUp(() async {
mockSyncStreamRepo = MockSyncStreamRepository();
diff --git a/mobile/test/infrastructure/repositories/sync_api_repository_test.dart b/mobile/test/infrastructure/repositories/sync_api_repository_test.dart
index d538b567bd..3a3e40cbae 100644
--- a/mobile/test/infrastructure/repositories/sync_api_repository_test.dart
+++ b/mobile/test/infrastructure/repositories/sync_api_repository_test.dart
@@ -37,7 +37,7 @@ void main() {
late MockHttpClient mockHttpClient;
late MockStreamedResponse mockStreamedResponse;
late StreamController<List<int>> responseStreamController;
- late int testBatchSize = 3;
+ const int testBatchSize = 3;
setUpAll(() async {
final db = Drift(DatabaseConnection(NativeDatabase.memory(), closeStreamsSynchronously: true));
diff --git a/mobile/test/infrastructure/repository.mock.dart b/mobile/test/infrastructure/repository.mock.dart
index 0688576682..355e128fc0 100644
--- a/mobile/test/infrastructure/repository.mock.dart
+++ b/mobile/test/infrastructure/repository.mock.dart
@@ -3,9 +3,9 @@ import 'package:immich_mobile/infrastructure/repositories/local_album.repository
import 'package:immich_mobile/infrastructure/repositories/local_asset.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/log.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/partner.repository.dart';
-import 'package:immich_mobile/infrastructure/repositories/settings.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/remote_album.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/remote_asset.repository.dart';
+import 'package:immich_mobile/infrastructure/repositories/settings.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/storage.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/store.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/sync_api.repository.dart';
diff --git a/mobile/test/medium/repositories/local_asset_repository_test.dart b/mobile/test/medium/repositories/local_asset_repository_test.dart
index bc74728346..d92b1c0184 100644
--- a/mobile/test/medium/repositories/local_asset_repository_test.dart
+++ b/mobile/test/medium/repositories/local_asset_repository_test.dart
@@ -456,7 +456,7 @@ void main() {
test('does not update when longitude does not match', () async {
final remoteAsset = await ctx.newRemoteAsset(ownerId: userId);
- final cloudIdAsset = await ctx.newRemoteAssetCloudId(id: remoteAsset.id, longitude: .fromNullable((-74.006)));
+ final cloudIdAsset = await ctx.newRemoteAssetCloudId(id: remoteAsset.id, longitude: .fromNullable(-74.006));
final localAsset = await ctx.newLocalAsset(
checksumOption: const Option.none(),
iCloudId: cloudIdAsset.cloudId,
diff --git a/mobile/test/medium/repositories/timeline_repository_test.dart b/mobile/test/medium/repositories/timeline_repository_test.dart
index 94b3413c9b..d78d9b1ef7 100644
--- a/mobile/test/medium/repositories/timeline_repository_test.dart
+++ b/mobile/test/medium/repositories/timeline_repository_test.dart
@@ -27,7 +27,7 @@ void main() {
// Regression check for #23273: a LEFT OUTER JOIN on checksum would fan out and create duplicates
// happens when same photo exists in multiple albums on device
final user = await ctx.newUser();
- final checksum = 'yolo';
+ const checksum = 'yolo';
final album = await ctx.newRemoteAlbum(ownerId: user.id);
final remoteAsset = await ctx.newRemoteAsset(ownerId: user.id, checksum: checksum);
await ctx.newRemoteAlbumAsset(albumId: album.id, assetId: remoteAsset.id);
diff --git a/mobile/test/modules/utils/async_mutex_test.dart b/mobile/test/modules/utils/async_mutex_test.dart
index 08cafeb307..10fdcbad5e 100644
--- a/mobile/test/modules/utils/async_mutex_test.dart
+++ b/mobile/test/modules/utils/async_mutex_test.dart
@@ -6,8 +6,8 @@ import 'package:immich_mobile/utils/async_mutex.dart';
void main() {
group('Test AsyncMutex grouped', () {
test('test ordered execution', () async {
- AsyncMutex lock = AsyncMutex();
- List<int> events = [];
+ final AsyncMutex lock = AsyncMutex();
+ final List<int> events = [];
expect(0, lock.enqueued);
unawaited(lock.run(() => Future.delayed(const Duration(milliseconds: 10), () => events.add(1))));
expect(1, lock.enqueued);
diff --git a/mobile/test/modules/utils/datetime_helpers_test.dart b/mobile/test/modules/utils/datetime_helpers_test.dart
index dfe83b4925..ca196224a0 100644
--- a/mobile/test/modules/utils/datetime_helpers_test.dart
+++ b/mobile/test/modules/utils/datetime_helpers_test.dart
@@ -10,38 +10,38 @@ void main() {
test('returns null for value below minimum allowed range', () {
// _minMillisecondsSinceEpoch = -62135596800000
- final seconds = -62135596800000 ~/ 1000 - 1; // One second before min allowed
+ const seconds = -62135596800000 ~/ 1000 - 1; // One second before min allowed
final result = tryFromSecondsSinceEpoch(seconds);
expect(result, isNull);
});
test('returns null for value above maximum allowed range', () {
// _maxMillisecondsSinceEpoch = 8640000000000000
- final seconds = 8640000000000000 ~/ 1000 + 1; // One second after max allowed
+ const seconds = 8640000000000000 ~/ 1000 + 1; // One second after max allowed
final result = tryFromSecondsSinceEpoch(seconds);
expect(result, isNull);
});
test('returns correct DateTime for minimum allowed value', () {
- final seconds = -62135596800000 ~/ 1000; // Minimum allowed timestamp
+ const seconds = -62135596800000 ~/ 1000; // Minimum allowed timestamp
final result = tryFromSecondsSinceEpoch(seconds);
expect(result, DateTime.fromMillisecondsSinceEpoch(-62135596800000));
});
test('returns correct DateTime for maximum allowed value', () {
- final seconds = 8640000000000000 ~/ 1000; // Maximum allowed timestamp
+ const seconds = 8640000000000000 ~/ 1000; // Maximum allowed timestamp
final result = tryFromSecondsSinceEpoch(seconds);
expect(result, DateTime.fromMillisecondsSinceEpoch(8640000000000000));
});
test('returns correct DateTime for negative timestamp', () {
- final seconds = -1577836800; // Dec 31, 1919 (pre-epoch)
+ const seconds = -1577836800; // Dec 31, 1919 (pre-epoch)
final result = tryFromSecondsSinceEpoch(seconds);
expect(result, DateTime.fromMillisecondsSinceEpoch(-1577836800 * 1000));
});
test('returns correct DateTime for zero timestamp', () {
- final seconds = 0; // Jan 1, 1970 (epoch)
+ const seconds = 0; // Jan 1, 1970 (epoch)
final result = tryFromSecondsSinceEpoch(seconds);
expect(result, DateTime.fromMillisecondsSinceEpoch(0));
});
diff --git a/mobile/test/modules/utils/debouncer_test.dart b/mobile/test/modules/utils/debouncer_test.dart
index 7aa13842d6..036c538f03 100644
--- a/mobile/test/modules/utils/debouncer_test.dart
+++ b/mobile/test/modules/utils/debouncer_test.dart
@@ -11,7 +11,7 @@ class _Counter {
void main() {
test('Executes the method after the interval', () async {
- var counter = _Counter();
+ final counter = _Counter();
final debouncer = Debouncer(interval: const Duration(milliseconds: 300));
debouncer.run(() => counter.increment());
expect(counter.count, 0);
@@ -20,17 +20,17 @@ void main() {
});
test('Executes the method immediately if zero interval', () async {
- var counter = _Counter();
- final debouncer = Debouncer(interval: const Duration(milliseconds: 0));
+ final counter = _Counter();
+ final debouncer = Debouncer(interval: Duration.zero);
debouncer.run(() => counter.increment());
// Even though it is supposed to be executed immediately, it is added to the async queue and so
// we need this delay to make sure the actual debounced method is called
- await Future.delayed(const Duration(milliseconds: 0));
+ await Future.delayed(Duration.zero);
expect(counter.count, 1);
});
test('Delayes method execution after all the calls are completed', () async {
- var counter = _Counter();
+ final counter = _Counter();
final debouncer = Debouncer(interval: const Duration(milliseconds: 100));
debouncer.run(() => counter.increment());
debouncer.run(() => counter.increment());
diff --git a/mobile/test/modules/utils/openapi_patching_test.dart b/mobile/test/modules/utils/openapi_patching_test.dart
index 18ab07b3a9..15d42c34f2 100644
--- a/mobile/test/modules/utils/openapi_patching_test.dart
+++ b/mobile/test/modules/utils/openapi_patching_test.dart
@@ -1,8 +1,8 @@
import 'dart:convert';
import 'package:flutter_test/flutter_test.dart';
-import 'package:openapi/api.dart';
import 'package:immich_mobile/utils/openapi_patching.dart';
+import 'package:openapi/api.dart';
void main() {
group('Test OpenApi Patching', () {
@@ -26,7 +26,7 @@ void main() {
});
test('addDefault', () {
- dynamic value = jsonDecode("""
+ final dynamic value = jsonDecode("""
{
"download": {
"archiveSize": 4294967296,
@@ -47,7 +47,7 @@ void main() {
});
test('addDefault with null', () {
- dynamic value = jsonDecode("""
+ final dynamic value = jsonDecode("""
{
"download": {
"archiveSize": 4294967296,
diff --git a/mobile/test/services/auth.service_test.dart b/mobile/test/services/auth.service_test.dart
index d71a52f2ae..b62ad3ad2c 100644
--- a/mobile/test/services/auth.service_test.dart
+++ b/mobile/test/services/auth.service_test.dart
@@ -103,7 +103,7 @@ void main() {
});
test('Should return null if auto endpoint switching is disabled', () async {
- when(() => authRepository.getEndpointSwitchingFeature()).thenReturn((false));
+ when(() => authRepository.getEndpointSwitchingFeature()).thenReturn(false);
final result = await sut.setOpenApiServiceEndpoint();
diff --git a/mobile/test/services/background_upload.service_test.dart b/mobile/test/services/background_upload.service_test.dart
index 65f17501a0..aa46bd9de3 100644
--- a/mobile/test/services/background_upload.service_test.dart
+++ b/mobile/test/services/background_upload.service_test.dart
@@ -1,7 +1,7 @@
import 'dart:convert';
import 'dart:io';
-import 'package:drift/drift.dart' hide isNull, isNotNull;
+import 'package:drift/drift.dart' hide isNotNull, isNull;
import 'package:drift/native.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
diff --git a/mobile/test/services/foreground_upload.service_test.dart b/mobile/test/services/foreground_upload.service_test.dart
index 46e9a82141..d4344ed77e 100644
--- a/mobile/test/services/foreground_upload.service_test.dart
+++ b/mobile/test/services/foreground_upload.service_test.dart
@@ -1,6 +1,6 @@
import 'dart:io';
-import 'package:drift/drift.dart' hide isNull, isNotNull;
+import 'package:drift/drift.dart' hide isNotNull, isNull;
import 'package:drift/native.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
diff --git a/mobile/test/unit/presentation/partner_page_test.dart b/mobile/test/unit/presentation/partner_page_test.dart
index 162094c720..ee9c6a3575 100644
--- a/mobile/test/unit/presentation/partner_page_test.dart
+++ b/mobile/test/unit/presentation/partner_page_test.dart
@@ -17,7 +17,7 @@ void main() {
group('PartnerSharedByList', () {
testWidgets('shows the empty-state add button when there are no partners', (tester) async {
- final action = const PartnerAddAction();
+ const action = PartnerAddAction();
await tester.pumpTestWidget(context, const PartnerSharedByList(partners: []));
@@ -39,7 +39,7 @@ void main() {
testWidgets('renders a remove action for each partner', (tester) async {
final partner1 = PartnerFactory.create(inTimeline: true);
final partner2 = PartnerFactory.create();
- final action = const PartnerRemoveAction(sharedWithId: '', partnerName: '');
+ const action = PartnerRemoveAction(sharedWithId: '', partnerName: '');
await tester.pumpTestWidget(context, PartnerSharedByList(partners: [partner1, partner2]));
expect(find.byIcon(action.icon), findsNWidgets(2));
});
diff --git a/mobile/test/unit/utils/editor_test.dart b/mobile/test/unit/utils/editor_test.dart
index 82cf584f76..6f3f41f374 100644
--- a/mobile/test/unit/utils/editor_test.dart
+++ b/mobile/test/unit/utils/editor_test.dart
@@ -4,7 +4,7 @@ import 'package:immich_mobile/utils/editor.utils.dart';
import 'package:openapi/api.dart' show MirrorAxis, MirrorParameters, RotateParameters;
List<AssetEdit> normalizedToEdits(NormalizedTransform transform) {
- List<AssetEdit> edits = [];
+ final List<AssetEdit> edits = [];
if (transform.mirrorHorizontal) {
edits.add(MirrorEdit(MirrorParameters(axis: MirrorAxis.horizontal)));
@@ -25,10 +25,10 @@ bool compareEditAffines(List<AssetEdit> editsA, List<AssetEdit> editsB) {
final normA = buildAffineFromEdits(editsA);
final normB = buildAffineFromEdits(editsB);
- return ((normA.a - normB.a).abs() < 0.0001 &&
+ return (normA.a - normB.a).abs() < 0.0001 &&
(normA.b - normB.b).abs() < 0.0001 &&
(normA.c - normB.c).abs() < 0.0001 &&
- (normA.d - normB.d).abs() < 0.0001);
+ (normA.d - normB.d).abs() < 0.0001;
}
void main() {
diff --git a/mobile/test/utils_legacy/action_button_utils_test.dart b/mobile/test/utils_legacy/action_button_utils_test.dart
index 0a6020762a..52d25c4c75 100644
--- a/mobile/test/utils_legacy/action_button_utils_test.dart
+++ b/mobile/test/utils_legacy/action_button_utils_test.dart
@@ -1074,7 +1074,7 @@ void main() {
test('should build correct widget for each button type', () {
for (final buttonType in ActionButtonType.values) {
- var buttonContext = context;
+ final buttonContext = context;
if (buttonType == ActionButtonType.removeFromAlbum) {
final album = createRemoteAlbum();