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