-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
鸿蒙版本的MMKV,double、float、int、bool现在不能返回undefined #1310
Comments
Noted. |
I have taken a deeper look into this issue. It is more complicated than I thought. The problem is that the Android interface, which many of you OHOS developers are familiar with, returns public decodeBool(key: string, defaultValue?: boolean): boolean | undefined; By default, it will return Now, how about we declare it as: public decodeBool(key: string, defaultValue?: boolean = false): boolean | undefined; The problem is that it won't compile. |
Maybe we have to drop the undefined default value. |
I've decided that |
let defaultValue:number | undefined = undefined
MMKV.decodeDouble("KEY_NOT_FUND", defaultValue)
返回的结果为0,不是想要的默认值undefined
标题中提到的int、float也是同样的
boolean类型返回默认值为false,也无法返回undefined。
返回undefined能知道是没有存过这个值。
The text was updated successfully, but these errors were encountered: