Fix historical recent messages not decoding properly

For non-ASCII characters, we need to explicitly decode with utf8.

Fixes Chat history encoding issue #396
This commit is contained in:
Tommy Chow 2024-09-11 19:09:22 -07:00
parent 3a4cd449f7
commit 1938fb910d

View file

@ -549,8 +549,11 @@ class TwitchApi {
);
final response = await _client.get(url);
final decodedBody = utf8.decode(response.bodyBytes);
if (response.statusCode == 200) {
return jsonDecode(response.body)['messages'] as List;
return jsonDecode(decodedBody)['messages'] as List;
} else {
return Future.error('Failed to get recent messages for $userLogin');
}