ra1u / redis-dart

fast redis protocol parser and client
MIT License
84 stars 35 forks source link

Migrates to null safety #26

Closed graphicbeacon closed 3 years ago

graphicbeacon commented 3 years ago

This resolves merge conflicts in this PR https://github.com/ra1u/redis-dart/pull/25

Credits to @Derrick56007

ra1u commented 3 years ago

@graphicbeacon Thank you for this. Before we can merge this, will need to make tests to pass and maybe add additional one.

I do have local version where everything except PubSub works, but I figured out that we should update some code and made improvements, to make sense about null safety. I don't see advantage in having null safety if everything can return null.

Plan is to release next major version with null safety. Null safety interface should be designed in safe way and I think that most functions in library should not return null.

graphicbeacon commented 3 years ago

@ra1u Cool, I figured code updates were needed when I looked through the source. Guess we should close this one then.

erf commented 3 years ago

@ra1u did you mean additional commits could be made to this PR to make the API more null safe (return more non null values). And also add more tests?

Maybe the return types also could be made more explicit instead of just returning Future?

ra1u commented 3 years ago

@erf correct.

Regarding more explicit Future we will need to change response from generic that can be string, int, list or even null Into RedisType that is wrapper around primitive types.

We should provide two sets of functions. One that do not accept and return null and other one that can be null but are backward compatible. For example:
Future<RedisType> send_object_safe(RedisType t) as null safe. Existing Future<generic!> send_object(generic t) as non null safe derived from send_object_safe.

graphicbeacon commented 3 years ago

@ra1u Familiarising myself with the codebase. Will let you know how it goes.

graphicbeacon commented 3 years ago

Haven't touched this piece in a bit. I'll try to fork directly from this repo. Closing

ra1u commented 3 years ago

closed by https://github.com/ra1u/redis-dart/pull/28