mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
if just one response is returned, return it as a single-item list
This commit is contained in:
parent
7863b7f209
commit
0108121db3
1 changed files with 6 additions and 2 deletions
|
@ -391,10 +391,14 @@ class ElectrumXClient {
|
|||
|
||||
final List<dynamic> response;
|
||||
try {
|
||||
response = jsonRpcResponse.data as List;
|
||||
if (jsonRpcResponse.data is Map) {
|
||||
response = [jsonRpcResponse.data];
|
||||
} else {
|
||||
response = jsonRpcResponse.data as List;
|
||||
}
|
||||
} catch (_) {
|
||||
throw Exception(
|
||||
"Expected json list but got a map: ${jsonRpcResponse.data}",
|
||||
"Expected json list or map but got a ${jsonRpcResponse.data.runtimeType}: ${jsonRpcResponse.data}",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue