I'm trying to get the value from Firestore with the following code. But I'm sorry I got this error. Help me

```
DocumentSnapshot snapshot = await FirebaseFirestore.instance.collection("users").doc(user.uid).get();

print(snapshot.data()["location"] as String);

```

Details of the error

```
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](https://i.stack.imgur.com/vkP2e.png)](https://i.stack.imgur.com/vkP2e.png)

I tried various things, for example `print(snapshot.data()!['location'] as String);`
[![enter image description here](https://i.stack.imgur.com/WHOtL.png)](https://i.stack.imgur.com/WHOtL.png)

error code

```
The operator '[]' isn't defined for the type 'Object'.  Try defining the operator '[]'.```

```