0

I have added into the app a new document/field which check when user will be again online. Of course these new field will be created by the user when they back online but where I check this exception I am trying to put an expeception for example:

widget.snapshot['lastAccess'] == null ? Container():The RightWidget

the problem is that this field is not null, it doesnt exist until the user login again into the app and this field will be created, but until this time I need to place an exception if the field doesnt exist. I tried also widget.snapshot['lastAccess'] ?? 'Not available ', but of course this method also check if the field is null... I need to catch the exception if the field doesnt exist...

1 Answers1

0

Check containsKey method like this

if(snapshot.data().containsKey("lastAccess")){

}
else{

}
Sal Man
  • 147
  • 1
  • 4