londonappbrewery / Flash-Chat-Flutter-Complete

The completed code for the Flash Chat Project - The Complete Flutter Development Bootcamp
https://www.appbrewery.co/
92 stars 133 forks source link

The operator '[]' isn't defined for the type 'Object? Function()'. #27

Open kimjong69 opened 2 years ago

kimjong69 commented 2 years ago

final messageText = message.data['text']; it says the operator [] isnt defined for the object pls help

blcouz commented 2 years ago

You should use message.get('text') instead of message.data['text'].

Nisa-fatima369 commented 2 years ago

final messageText = (message.data() as Map<String, dynamic>)['text']; try this