From f7dad5e4195ed1e0c5d979697b0c68e7aecd5f61 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 6 Sep 2025 13:09:27 +0800 Subject: [PATCH] :zap: Cache udid --- lib/services/udid.native.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/services/udid.native.dart b/lib/services/udid.native.dart index 12ef61af..1faa2731 100644 --- a/lib/services/udid.native.dart +++ b/lib/services/udid.native.dart @@ -1,5 +1,11 @@ import 'package:flutter_udid/flutter_udid.dart'; +String? _cachedUdid; + Future getUdid() async { - return await FlutterUdid.consistentUdid; + if (_cachedUdid != null) { + return _cachedUdid!; + } + _cachedUdid = await FlutterUdid.consistentUdid; + return _cachedUdid!; }