mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
20 lines
550 B
Dart
20 lines
550 B
Dart
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
|
|
class ProjectCubit extends Cubit<String?> {
|
|
final FlutterSecureStorage storage;
|
|
static const String projectKey = "selected_project_uuid";
|
|
|
|
ProjectCubit(this.storage) : super(null);
|
|
|
|
Future<void> setProjectUUID(String newUUID) async {
|
|
await storage.write(key: projectKey, value: newUUID);
|
|
emit(newUUID);
|
|
}
|
|
|
|
Future<void> clearProjectUUID() async {
|
|
await storage.delete(key: projectKey);
|
|
emit(null);
|
|
}
|
|
}
|