24 lines
669 B
Dart
Executable File
24 lines
669 B
Dart
Executable File
import 'package:injectable/injectable.dart';
|
|
import 'package:uae_stat/domain/entities/preferences_entity.dart';
|
|
import 'package:uae_stat/domain/repos/t_local_preferences_repo.dart';
|
|
import 'package:uae_stat/infrastructure/services/shared_prefs_wrapper.dart';
|
|
|
|
@dev
|
|
@prod
|
|
@Injectable(as: TLocalPreferencesRepo)
|
|
class PLocalPreferencesRepo implements TLocalPreferencesRepo {
|
|
static final _repo = SharedPrefsWrapper(
|
|
key: 'preferences',
|
|
fromJson: (json) => PreferencesEntity.fromJson(json),
|
|
);
|
|
|
|
@override
|
|
Future<PreferencesEntity?> get() => _repo.get();
|
|
|
|
@override
|
|
Future<void> update(
|
|
PreferencesEntity updated,
|
|
) =>
|
|
_repo.set(updated);
|
|
}
|