mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-05-14 18:39:05 +02:00
e6b2442eea
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
34 lines
809 B
Dart
34 lines
809 B
Dart
import "package:arcane_framework/arcane_framework.dart";
|
|
import "package:flutter/foundation.dart";
|
|
import "package:uuid/uuid.dart";
|
|
|
|
class IdService extends ArcaneService {
|
|
static final IdService _instance = IdService._internal();
|
|
static IdService get I => _instance;
|
|
|
|
IdService._internal();
|
|
|
|
bool _initialized = false;
|
|
bool get initialized => I._initialized;
|
|
|
|
String? _sessionId;
|
|
ValueListenable<String?> get sessionId =>
|
|
ValueNotifier<String?>(I._sessionId);
|
|
|
|
String get newId => uuid.v7();
|
|
|
|
/// The `Uuid` instance used for generating unique IDs.
|
|
static const Uuid uuid = Uuid();
|
|
|
|
Future<void> init() async {
|
|
Arcane.log(
|
|
"Initializing ID Service",
|
|
level: Level.debug,
|
|
);
|
|
|
|
I._sessionId = uuid.v7();
|
|
I._initialized = true;
|
|
notifyListeners();
|
|
}
|
|
}
|