Another beautiful day fixes and changed version again!

This commit is contained in:
M
2021-01-12 20:58:42 +02:00
parent a4ead9c2ba
commit 7ba379f388
3 changed files with 8 additions and 11 deletions
+4 -7
View File
@@ -37,7 +37,8 @@ class ElectrumClient {
ElectrumClient()
: _id = 0,
_isConnected = false,
_tasks = {};
_tasks = {},
unterminatedString = '';
static const connectionTimeout = Duration(seconds: 5);
static const aliveTimerDuration = Duration(seconds: 2);
@@ -80,11 +81,7 @@ class ElectrumClient {
} on FormatException catch (e) {
final msg = e.message.toLowerCase();
if (msg == 'Unterminated string'.toLowerCase()) {
unterminatedString = e.source as String;
}
if (msg == 'Unexpected character'.toLowerCase()) {
if (e.source is String) {
unterminatedString += e.source as String;
}
@@ -97,7 +94,7 @@ class ElectrumClient {
final response =
json.decode(unterminatedString) as Map<String, Object>;
_handleResponse(response);
unterminatedString = null;
unterminatedString = '';
}
} on TypeError catch (e) {
if (!e.toString().contains('Map<String, Object>')) {