33 lines
977 B
Dart
Executable File
33 lines
977 B
Dart
Executable File
import 'package:external_repos/external_repos.dart';
|
|
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:injectable/injectable.dart';
|
|
import 'package:uae_stat/domain/entities/preferences_entity.dart';
|
|
|
|
@test
|
|
@injectable
|
|
class TLocalPreferencesRepo {
|
|
static PreferencesEntity _cache = PreferencesEntity(
|
|
language: LanguageLocale.arAE,
|
|
favoriteIndicators: <IndicatorEnum>[].toIList(),
|
|
favoriteCountries: <ISOCountry>[].toIList(),
|
|
favoriteReports: <String>[].toIList(),
|
|
doNotifyOnIndicatorUpdates: false,
|
|
doNotifyOnCompetitivenessReportsUpdates: true,
|
|
doNotifyOnCountryUpdates: false,
|
|
);
|
|
|
|
Future<PreferencesEntity?> get() => Future.delayed(
|
|
kThemeAnimationDuration,
|
|
() => _cache,
|
|
);
|
|
|
|
Future<void> update(
|
|
PreferencesEntity updated,
|
|
) =>
|
|
Future.delayed(
|
|
kThemeAnimationDuration,
|
|
() => _cache = updated,
|
|
);
|
|
}
|