getHealth method Null safety

Future<GetHealthResponse> getHealth()

General node health check request. See: https://soroban.stellar.org/api/methods/getHealth

Implementation

Future<GetHealthResponse> getHealth() async {
  if (!this.acknowledgeExperimental) {
    printExperimentalFlagErr();
    return GetHealthResponse.fromJson(_experimentalErr);
  }

  JsonRpcMethod getHealth = JsonRpcMethod("getHealth");
  dio.Response response = await _dio.post(_serverUrl,
      data: json.encode(getHealth), options: dio.Options(headers: _headers));
  if (enableLogging) {
    print("getHealth response: $response");
  }
  return GetHealthResponse.fromJson(response.data);
}