Git Product home page Git Product logo

Comments (6)

FunnySaltyFish avatar FunnySaltyFish commented on May 29, 2024
  1. remove 方法确实可以提供,我思索了下,会同时在 DataSaverState 中新增 remove(new_value: T) 方法,用于移除对应项并更新 state 的值,感谢建议
  2. 非空的设计主要来源于,最早这个框架主要保存 基本类型 ,我认为它们的默认值非 null 有助于减少异常的发生;你说的情况也确实合理,我再想想,后续应该会允许 null

from composedatasaver.

guozhiqiang123 avatar guozhiqiang123 commented on May 29, 2024

基础类型设计为非空的确有助于精简代码,减少非空判断。
你可以再提供一个@composable,专门提供默认值和返回值都允许空的方法。

from composedatasaver.

guozhiqiang123 avatar guozhiqiang123 commented on May 29, 2024

另外,DataSaverMMKV我觉得没必要是普通class。可以直接搞成object class。这样不仅好初始化,而且在@composable之外调用也比较简单。

from composedatasaver.

FunnySaltyFish avatar FunnySaltyFish commented on May 29, 2024

有道理,我会综合考虑的

from composedatasaver.

FunnySaltyFish avatar FunnySaltyFish commented on May 29, 2024

前段时间比较忙,我今天集中时间写了下,按你的建议变化如下

  1. MMKV 的实现新增 DefaultDataSaverMMKV 变量,调用起来简单些(没有做 object 处理是因为要照顾到 不同 mmkv 的 需求)
  2. registerTypeConverter 的类型放宽了 null 的限制,现在自定义 Bean 可以设 null 的初值了(见 示例
  3. 提供了 remove 方法
    目前还未上传 jitpack,预估今晚做。这之前你有建议的话欢迎讨论,我再修改

from composedatasaver.

FunnySaltyFish avatar FunnySaltyFish commented on May 29, 2024

v1.1.4 已发,有其他建议欢迎继续交流

from composedatasaver.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.