From c4c651bc1ae96cbb5dea0a418df6dc6927464a4f Mon Sep 17 00:00:00 2001 From: Nitish Kumar Singh Date: Mon, 4 Oct 2021 16:59:56 +0530 Subject: [PATCH 1/2] capitalize extension fix --- packages/stream_chat_flutter/lib/src/extension.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. /// From 195b95e16e8603b730e331ffc1526c82841907e3 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 4 Oct 2021 13:36:42 +0200 Subject: [PATCH 2/2] chore(ui): update changelog --- packages/stream_chat_flutter/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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