1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-06 06:07:29 +02:00
Files
immich/mobile/lib/services/device.service.dart
shenlong 5b0575b956 refactor: DCM - const border radius, constructor & switch expressions (#19515)
* enable border radius, switch exp, const constructor

* regenerate provider

* more formatting

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
2025-06-25 13:06:24 +05:30

26 lines
888 B
Dart

import 'package:flutter_udid/flutter_udid.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/entities/store.entity.dart';
final deviceServiceProvider = Provider((ref) => const DeviceService());
class DeviceService {
const DeviceService();
createDeviceId() {
return FlutterUdid.consistentUdid;
}
/// Returns the device ID from local storage or creates a new one if not found.
///
/// This method first attempts to retrieve the device ID from the local store using
/// [StoreKey.deviceId]. If no device ID is found (returns null), it generates a
/// new device ID by calling [createDeviceId].
///
/// Returns a [String] representing the device's unique identifier.
String getDeviceId() {
return Store.tryGet(StoreKey.deviceId) ?? createDeviceId();
}
}