From 845e92fa7dcd2cbd3b9fc9d0baf27be79a4898c7 Mon Sep 17 00:00:00 2001 From: Lixi20 Date: Fri, 4 Sep 2026 14:55:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20UserProfile.phone=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=8F=AF=E7=A9=BA=EF=BC=8C=E6=B6=88=E9=99=A4=E9=9D=9E=E7=A9=BA?= =?UTF-8?q?=E5=BC=BA=E8=BD=AC=E5=B4=A9=E6=BA=83=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 跨端契约核对发现(功能清单「跨端核对发现」项):服务端 phone 可返回 null - 门禁:format 0 changed / analyze 0 issues / flutter test 30 passed --- lib/features/auth/auth_models.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/features/auth/auth_models.dart b/lib/features/auth/auth_models.dart index e57da99..223ba2f 100644 --- a/lib/features/auth/auth_models.dart +++ b/lib/features/auth/auth_models.dart @@ -45,13 +45,14 @@ class UserProfile { return UserProfile( userId: json['userId'] as String, username: json['username'] as String, - phone: json['phone'] as String, + // 服务端可返回 null(历史数据或未来第三方注册),不得非空强转。 + phone: json['phone'] as String?, createdAt: DateTime.parse(json['createdAt'] as String), ); } final String userId; final String username; - final String phone; + final String? phone; final DateTime createdAt; }