2021年3月5日星期五

The argument type 'Null Function(Reaction, int)' can't be assigned to the parameter type 'dynamic Function(Reaction, int, bool)'

Hello I am having the below error in my code. I really really appreciate any help! This is the error output

Error: The argument type 'Null Function(Reaction, int)' can't be assigned to the parameter type 'dynamic Function(Reaction, int, bool)'.

Error: A value of type 'int' can't be assigned to a variable of type 'bool'. if (isChecked) { ^

                                             ^          return FlutterReactionButtonCheck(                            onReactionChanged: (reaction, isChecked) {                              setState(() {                                post.myReaction = Reaction(                                    id: reaction.id,                                    icon: reaction.icon,                                    previewIcon: reaction.previewIcon);                              });                              if (isChecked) {                                bool isNewReaction = false;                                SocialReactionModel postReaction =                                    _reactionsList.firstWhere(                                        (element) =>                                            element.postID == post.id,                                        orElse: () {                                  isNewReaction = true;                                  String reactionString =                                      getReactionString(reaction.id);                                  SocialReactionModel newReaction =                                      SocialReactionModel(                                          postID: post.id,                                          createdAt: Timestamp.now(),                                          reactionAuthorID:                                              MyAppState.currentUser.userID,                                          reaction: reactionString);                                  _reactionsList.add(newReaction);                                  return newReaction;                                });                                if (isNewReaction) {                                  setState(() {                                    post.reactionsCount++;                                  });                                  fireStoreUtils.postReaction(                                      postReaction, post);                                } else {                                  postReaction.reaction =                                      getReactionString(reaction.id);                                  postReaction.createdAt = Timestamp.now();                                  fireStoreUtils.updateReaction(                                      postReaction, post);                                }                              } else {                                _reactionsList.removeWhere(                                    (element) => element.postID == post.id);                                setState(() {                                  post.reactionsCount--;                                });                                fireStoreUtils.removeReaction(post);                              }                            },  
https://stackoverflow.com/questions/66501704/the-argument-type-null-functionreaction-int-cant-be-assigned-to-the-parame March 06, 2021 at 10:07AM

没有评论:

发表评论