f2prateek / rx-preferences

Reactive SharedPreferences for Android
http://f2prateek.com/2015/10/05/rx-preferences/
Apache License 2.0
1.54k stars 132 forks source link

Expose an api for entirely non-null preferences #122

Closed pforhan closed 6 years ago

pforhan commented 6 years ago

It'd be very nice for cases where you don't have a null default and don't ever set null into a preference to have a clean non-null version of Preference. Would make kotlin interop better as well.

Looking through issue history, seems like there's a lot of conflicting threads pulling the library around nulls. Rather than force a change to existing Preferences a new set of NonNullPreference (though with a better name?) methods would be an easy change.

I could whip up a pull if this is appealing.

f2prateek commented 6 years ago

Would make kotlin interop better as well.

Can you describe some examples where the Kotlin interop can be improved?

pforhan commented 6 years ago

Basically I wouldn't have to be reading (for example) Boolean? or need to use !! to assert that it really wasn't null.

NightlyNexus commented 6 years ago

are you on 2.0.0? i thought null was already banned in preferences now.

pforhan commented 6 years ago

oops, no, still on an older version.

pforhan commented 6 years ago

looks like this has been resolved, so sorry. I checked issues but not the latest code, oops.