'error: The operator '[]' isn't defined for the type 'Object'. of flutter
I'm going to update the data related to Comant in the post documentary, and if there are too many Comant, I'm going to implement writing down how many Comant there are, but there is an error.
int numOfComments = postSnapshot.data[KEY_NUMOFCOMMENTS];
tx.update(postRef, {
KEY_NUMOFCOMMENTS: numOfComments+1,
KEY_LASTCOMMENT: commentData[KEY_LASTCOMMENT],
KEY_LASTCOMMENTTIME: commentData[KEY_COMMENTTIME],
KEY_LASTCOMMENTOR: commentData[KEY_USERKEY],
I wrote it like this, but there's an error. I looked it up, and I was told to write () next to the data, but there's an error.
There's an error like this. error: The operator '[]' isn't defined for the type 'Object'. (undefined_operator at [instagram] lib/repo/comment_network_repository.dart:21)enter image description here
Is there a problem with KEY_NUMOFCOMENTS?
const KEY_NUMOFCOMMENTS='num_of_last_comments';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
