diff --git a/lib/electrumx_rpc/electrumx.dart b/lib/electrumx_rpc/electrumx.dart index 88c49cc45..eea9bed0b 100644 --- a/lib/electrumx_rpc/electrumx.dart +++ b/lib/electrumx_rpc/electrumx.dart @@ -387,7 +387,14 @@ class ElectrumX { throw jsonRpcResponse.exception!; } - final response = jsonRpcResponse.data as List; + final List response; + try { + response = jsonRpcResponse.data as List; + } catch (_) { + throw Exception( + "Expected json list but got a map: ${jsonRpcResponse.data}", + ); + } // check for errors, format and throw if there are any final List errors = [];