895dcbe343
* Improve example app ui * Store favorite services in local storage * Use Text instead of SelectableText * Improve colors * Fix flutter analyzer issues * Revert example app minimum sdk requirement * Implement hasPermission api and improve ui flow * More ui improvements * Improve ScannedItem ui * Improve control ui * Change color theme to blue * Minor improvements wip * improve responsive ui and flow * More improvements * More improvements * Update Mac podfile * Fix home page scroll view * Update app and package name * Revert changelog * Resolve Ai comments --------- Co-authored-by: Foti Dim <foti@navideck.com>
23 lines
675 B
Dart
23 lines
675 B
Dart
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
class StorageService {
|
|
StorageService._();
|
|
static StorageService? _instance;
|
|
static StorageService get instance => _instance ??= StorageService._();
|
|
|
|
late SharedPreferencesWithCache _preferences;
|
|
|
|
Future<void> init() async {
|
|
_preferences = await SharedPreferencesWithCache.create(
|
|
cacheOptions: const SharedPreferencesWithCacheOptions(),
|
|
);
|
|
}
|
|
|
|
Future<void> setFavoriteServices(List<String> services) async {
|
|
await _preferences.setStringList('favorite_services', services);
|
|
}
|
|
|
|
List<String> getFavoriteServices() =>
|
|
_preferences.getStringList('favorite_services') ?? [];
|
|
}
|