felixblaschke / shelf_plus

MIT License
73 stars 14 forks source link

_Invalid argument(s): Can not resolve response._ when returning empty list #7

Closed exaby73 closed 2 years ago

exaby73 commented 2 years ago

When returning an empty List from a handler function, this error is thrown.

Example:

app.get('/', () => []);
felixblaschke commented 2 years ago

Hi @exaby73 , what is the expected behavior? Returning a [] JSON response with status code 200?

felixblaschke commented 2 years ago

Okayyy.. I fixed it with version 1.0.2. Thanks for reporting... happy coding!

exaby73 commented 2 years ago

Thanks :) And yeah, building a RESTful API, you would return empty list or map if there's no data. That would be expected. Awesome library :D As soon as I am better at server side code with Dart, I plan on contributing to this project since I believe that Dart is well suited for backend development. Just wish the Dart team gave more focus to server-side Dart instead of focusing mostly on UI ie Flutter

felixblaschke commented 2 years ago

There is a small part in the dart dev team that propagates on server-related stuff: https://dart.dev/server You can talk with https://twitter.com/kevmoo if you have any efforts in contributing to the server-side dart ecosystem.