kfiross/flutter_mongodb_realm

How to return a null doc after query call

Closed this issue · 1 comments

i am trying to get a doc with code below,
final doc = await _col.findOne(
filter: {
"email": email,
});
but when the doc does not exist, it does not give a null doc but returns an error which says
NoSuchMethodError: The getter 'length' was called on null.

How do i handle such errors?

Thanks!

Thanks for the PR!