Open lukehutch opened 4 months ago
Bonjour Luka. Merci de prendre le temps de m'écrire pour les problèmes de mon package. En effet le null check operator ne devrait pas être utilisé ici. d'autant plus qu'il y a une valeur par défaut. je vais prendre cela en compte dans ma prochaine mise à jour
Le jeu. 2 mai 2024 à 23:02, Luke Hutchison @.***> a écrit :
If I call
child: TimestampedChatMessage( text: message.message, sentAt: message.timestamp!.formattedTimeHm, ),
Then I get Null check operator used on a null value
which throws here:
return TimestampedChatMessageRenderObject( text: text, sentAt: sentAt, delimiter: delimiter, textDirection: Directionality.of(context), textStyle: effectiveTextStyle!, sentAtStyle: effectiveTextStyle .copyWith( color: style!.color!.withAlpha(180), // <---------- here fontSize: 13, ) .merge(sentAtStyle), maxLines: maxLines, showMoreText: viewMoreText, showsTextStyle: showTextStyle!, sendingStatusIcon: sendingStatusIcon != null ? String.fromCharCode(sendingStatusIcon!.icon!.codePoint) : null, sendingStatusIconStyle: sendingStatusIcon != null ? iconTextStyle : null, );
}
because style is only an optional parameter:
const TimestampedChatMessage({ super.key, required this.text, required this.sentAt, this.sendingStatusIcon, this.style, this.sentAtStyle, this.showMoreTextStyle, this.maxLines, this.delimiter = '\u2026', this.viewMoreText = 'showMore', }); final String text; final String sentAt; final String delimiter; final Icon? sendingStatusIcon; final TextStyle? style; final TextStyle? showMoreTextStyle; final TextStyle? sentAtStyle; final int? maxLines; final String viewMoreText;
You may need to check the other uses of ! too -- it should be used sparingly!
— Reply to this email directly, view it on GitHub https://github.com/AliouneSakho/chat_message_timestamp/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4QV57MNHXBBSAE6BFLMUGTZAKSW7AVCNFSM6AAAAABHENY47CVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3TMNBXG44TAMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
If I call
Then I get
Null check operator used on a null value
which throws here:
because
style
is only an optional parameter:You may need to check the other uses of
!
too -- it should be used sparingly!