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.
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!