diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 9e4f2744..d5e21c54 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -4,6 +4,7 @@ -[[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads. - Fixed floating date stream subscription causing "Bad state: stream has already been listened.” error. +- Fixed `String` capitalize extension not working on empty strings. ✅ Added diff --git a/packages/stream_chat_flutter/lib/src/extension.dart b/packages/stream_chat_flutter/lib/src/extension.dart index 9551a40d..0072a811 100644 --- a/packages/stream_chat_flutter/lib/src/extension.dart +++ b/packages/stream_chat_flutter/lib/src/extension.dart @@ -12,7 +12,7 @@ final _emojiChars = Emoji.chars(); extension StringExtension on String { /// Returns the capitalized string String capitalize() => - '${this[0].toUpperCase()}${substring(1).toLowerCase()}'; + isNotEmpty ? '${this[0].toUpperCase()}${substring(1).toLowerCase()}' : ''; /// Returns whether the string contains only emoji's or not. ///