getLedgerEntry method Null safety

Future<GetLedgerEntryResponse> getLedgerEntry(
  1. String base64EncodedKey
)

For reading the current value of ledger entries directly. Allows you to directly inspect the current state of a contract, a contract’s code, or any other ledger entry. This is a backup way to access your contract data which may not be available via events or simulateTransaction. To fetch contract wasm byte-code, use the ContractCode ledger entry key. See: https://soroban.stellar.org/api/methods/getLedgerEntry

Implementation

Future<GetLedgerEntryResponse> getLedgerEntry(String base64EncodedKey) async {
  if (!this.acknowledgeExperimental) {
    printExperimentalFlagErr();
    return GetLedgerEntryResponse.fromJson(_experimentalErr);
  }

  JsonRpcMethod getLedgerEntry =
      JsonRpcMethod("getLedgerEntry", args: {'key': base64EncodedKey});
  dio.Response response = await _dio.post(_serverUrl,
      data: json.encode(getLedgerEntry), options: dio.Options(headers: _headers));
  if (enableLogging) {
    print("getLedgerEntry response: $response");
  }
  return GetLedgerEntryResponse.fromJson(response.data);
}