add proper logging

This commit is contained in:
shenlong-tanwen
2024-08-21 23:43:48 +05:30
parent 1631df70e9
commit 75448ce56b
37 changed files with 923 additions and 224 deletions
+22 -2
View File
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:immich_mobile/domain/interfaces/store.interface.dart';
import 'package:immich_mobile/domain/models/user.model.dart';
import 'package:immich_mobile/domain/utils/store_converters.dart';
import 'package:immich_mobile/presentation/modules/theme/models/app_theme.model.dart';
@@ -21,14 +22,33 @@ class StoreValue<T> {
int get hashCode => id.hashCode ^ value.hashCode;
}
class StoreKeyNotFoundException implements Exception {
final StoreKey key;
const StoreKeyNotFoundException(this.key);
@override
String toString() => "Key '${key.name}' not found in Store";
}
/// Key for each possible value in the `Store`.
/// Also stores the converter to convert the value to and from the store and the type of value stored in the Store
enum StoreKey<T, U> {
serverEndpoint<String, String>(
0,
converter: StorePrimitiveConverter(),
converter: StoreStringConverter(),
type: String,
),
accessToken<String, String>(
1,
converter: StoreStringConverter(),
type: String,
),
currentUser<User, String>(
2,
converter: StoreUserConverter(),
type: String,
),
// App settings
appTheme<AppTheme, int>(
1000,
converter: StoreEnumConverter(AppTheme.values),
@@ -44,7 +64,7 @@ enum StoreKey<T, U> {
const StoreKey(this.id, {required this.converter, required this.type});
final int id;
/// Type is also stored here easily fetch it during runtime
/// Primitive Type is also stored here to easily fetch it during runtime
final Type type;
final IStoreConverter<T, U> converter;
}