fix: UserProfile.phone 改为可空,消除非空强转崩溃点
- 跨端契约核对发现(功能清单「跨端核对发现」项):服务端 phone 可返回 null - 门禁:format 0 changed / analyze 0 issues / flutter test 30 passed
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user