invertase / dart_edge

Run Dart on the Edge - supporting Vercel & Cloudflare Workers (more coming soon).
https://docs.dartedge.dev
Apache License 2.0
322 stars 23 forks source link

Error while accessing empty KV keys #14

Closed mukhtharcm closed 1 year ago

mukhtharcm commented 1 year ago

While accessing non existing kv keys, currently it's throwing an error. Unhandled Promise Rejection: Error: TypeError: null: type 'JSNull' is not a subtype of type 'FutureOr<String>'

I'm no expert in these, but a better idea would be to make the return type of get from kvNamespace from Future<String> to Future<String?> . Then we can check if the key exists by checking if the value is null.

Ehesp commented 1 year ago

Ah thanks, I'll sort that. Still trying to figure out how to properly test everything 😅

mukhtharcm commented 1 year ago

Thank you for the fast response!

Ehesp commented 1 year ago

Should be fixed here https://github.com/invertase/dart_edge/commit/f1dba9960570e1f2d4cc57b5ccf82257eaee12ac and in 0.0.2+2

Ehesp commented 1 year ago

Figured out a testing flow now sorted will be able to test everything 👍