2023-07-29 09:25:21 +08:00
|
|
|
import 'package:get/get.dart';
|
2025-02-26 19:08:46 +08:00
|
|
|
import 'package:star_lock/tools/storage.dart';
|
|
|
|
|
import 'package:uuid/uuid.dart';
|
2023-07-29 09:25:21 +08:00
|
|
|
|
|
|
|
|
class AppBindings extends Bindings {
|
|
|
|
|
@override
|
|
|
|
|
void dependencies() {
|
2025-02-26 19:08:46 +08:00
|
|
|
initDeviceId();
|
2023-07-29 09:25:21 +08:00
|
|
|
}
|
|
|
|
|
|
2025-02-26 19:08:46 +08:00
|
|
|
Future<void> initDeviceId() async {
|
|
|
|
|
final String? deviceID = await Storage.getString(appDeviceID);
|
|
|
|
|
final bool isNullOrBlank = GetUtils.isNullOrBlank(deviceID) ?? true;
|
|
|
|
|
if (isNullOrBlank) {
|
|
|
|
|
final String uuidV4 = const Uuid().v4();
|
|
|
|
|
print('initDeviceId UUID:v4: $uuidV4');
|
|
|
|
|
await Storage.setString(appDeviceID, uuidV4);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|