skip to Main Content

I have this problem in my snapshot

The method ‘[]’ can’t be unconditionally invoked because the receiver can be ‘null’.
Try making the call conditional (using ‘?.’) or adding a null check to the target (‘!’).

enter image description here
enter image description here

enter image description here

enter image description here

Greetings I hope you are very well, someone could help me, it is my first time creating a mobile app and with firebare.

I tried by Var, put ! and nothing, I am not very aware of the error.

2

Answers


  1. Chosen as BEST ANSWER

    I changed the version of the dependencies and the problem was solved.

    before

    firebase_core: ^2.1.1
    cloud_firestore: ^4.0.3
    firebase_database: ^10.0.2
    

    after

    firebase_core: ^1.4.0
    cloud_firestore: ^3.1.5
    firebase_database: ^6.0.0 
    

  2. try this

    var horario = snapshot.value == null ? "" : snapshot.value!['nombre']; 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search