setThemeMode method
- AppThemeMode mode
override
Sets the theme mode
Implementation
@override
Future<Either<Failure, void>> setThemeMode(AppThemeMode mode) async {
try {
await _isar.writeTxn(() async {
final existing = await _isar.appPreferencesDtos.get(_prefsId);
final dto = existing ?? (await _paramsFromDefaults());
dto.themeMode = mode.name;
await _isar.appPreferencesDtos.put(dto);
});
return const Right(null);
} catch (e) {
return Left(CacheFailure("Failed to set theme mode: $e"));
}
}