Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
Sign in
Sign up
Fetch the repository succeeded.
The current repo belongs to Closed status, and some functions are restricted. For details, please refer to the
description of repo status
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
19
Star
124
Fork
136
OpenHarmony-SIG
/
flutter_packages
Closed
Code
Issues
190
Pull Requests
12
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
shared_preferences 读取导致白屏
Backlog
#IATPBG
Task
jianrentang
Opened this issue
2024-09-26 00:30
**【任务描述】** 在存入超大的整数时,调用 setInt ,发现源码中强行转为了 Number 存储,导致业务层 getInt 无法读取到,甚至卡死。 源码实现见 [SharedPreferencesOhosPlugin.ets](https://gitee.com/openharmony-sig/flutter_packages/blob/master/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/ets/shared_preferences/SharedPreferencesOhosPlugin.ets) ``` setInt(key: string, value: number): Promise<void> { if(typeof value == "bigint") { return this.put(key, Number(value)); } return this.put(key, value); } ``` 内部将 bigint 转为了 Number 存储,但是业务层在 setInt 时,**无任何提示以及报错**。 同时,业务层再通过 `getInt` 读取时,直接卡死,**无任何报错信息**。 最后发现只能通过 `getDouble` 读取出来,也就是,最后成了一个 double 类型。 - 没任何提示,即便读取失败也没有抛出异常 - 无论底层如何实现,即便 int 转为了 double,但不应该导致业务层出现 setInt getDouble 的情况。
**【任务描述】** 在存入超大的整数时,调用 setInt ,发现源码中强行转为了 Number 存储,导致业务层 getInt 无法读取到,甚至卡死。 源码实现见 [SharedPreferencesOhosPlugin.ets](https://gitee.com/openharmony-sig/flutter_packages/blob/master/packages/shared_preferences/shared_preferences_ohos/ohos/src/main/ets/shared_preferences/SharedPreferencesOhosPlugin.ets) ``` setInt(key: string, value: number): Promise<void> { if(typeof value == "bigint") { return this.put(key, Number(value)); } return this.put(key, value); } ``` 内部将 bigint 转为了 Number 存储,但是业务层在 setInt 时,**无任何提示以及报错**。 同时,业务层再通过 `getInt` 读取时,直接卡死,**无任何报错信息**。 最后发现只能通过 `getDouble` 读取出来,也就是,最后成了一个 double 类型。 - 没任何提示,即便读取失败也没有抛出异常 - 无论底层如何实现,即便 int 转为了 double,但不应该导致业务层出现 setInt getDouble 的情况。
Comments (
1
)
Sign in
to comment
Status
Backlog
Backlog
Doing
Done
Declined
Assignees
Not set
Labels
Not set
Projects
Unprojected
Unprojected
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (15)
Tags (34)
master
br_shared_preferences-v2.3.2_ohos
br_camera-v0.11.0+2_ohos
br_image_picker-v1.1.2_ohos
br_webview_flutter-v4.8.0_ohos
br_url_launcher-v6.3.0_ohos
pigeon-v21.2.0
br_in_app_purchase-v3.2.0_ohos
br_file_selector-v1.0.3_ohos
br_video_player-v2.9.2_ohos
br_local_auth-v2.3.0_ohos
br_path_provider-v2.1.4_ohos
3.7.12-ohos-1.0.0
3.7.12-ohos-1.0.1
br_optimize_har_structure
3.7.12-ohos-1.0.3
github.com/flutter/packages.git/video_player-v2.9.2
3.7.12-ohos-1.0.1
3.7.12-ohos-1.0.0
github.com/flutter/packages.git/shared_preferences-v2.3.2
github.com/flutter/packages/pigeon-v21.2.0
github.com/flutter/packages.git/local_auth-v2.3.0
github.com/flutter/packages.git/camera-v0.11.0+2
github.com/flutter/packages.git/path_provider-v2.1.4
github.com/flutter/packages.git/url_launcher-v6.3.0
github.com/flutter/packages.git/image_picker-v1.1.2
github.com/flutter/packages.git/webview_flutter-v4.8.0
webview_flutter_ohos-v3.9.3
webview_flutter-v4.2.4
video_player_ohos-v1.0.0+1
video_player-v2.7.1
url_launcher_ohos-v6.0.38
url_launcher-v6.1.12
shared_preferences_ohos-v2.2.0
shared_preferences-v2.2.0
pigeon-v11.0.1
path_provider_ohos-v2.2.1
path_provider-v2.1.0
local_auth_ohos-v1.0.0
local_auth-v2.1.6
image_picker_ohos-v0.8.7+4
image_picker-v1.0.2
file_selector_ohos-v0.5.0+2
file_selector-v1.0.0
camera-v0.10.5+4
camera_ohos-v0.10.8+8
github.com/flutter/packages.git/refs/tags/in_app_purchase-v3.2.0
github.com/flutter/packages.git/file_selector-v1.0.3
2023-09-05_17_23_05/github.com/flutter/packages.git/main
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
Duration
(hours)
参与者(1)
1
https://gitee.com/openharmony-sig/flutter_packages.git
git@gitee.com:openharmony-sig/flutter_packages.git
openharmony-sig
flutter_packages
flutter_packages
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register