deviceId property

String? get deviceId

Get device ID from C++ state

Implementation

String? get deviceId {
  try {
    final lib = PlatformLoader.loadCommons();
    final getDeviceId = lib.lookupFunction<Pointer<Utf8> Function(),
        Pointer<Utf8> Function()>('rac_state_get_device_id');

    final result = getDeviceId();
    if (result == nullptr) return null;
    final str = result.toDartString();
    return str.isEmpty ? null : str;
  } catch (e) {
    return null;
  }
}