gasPrice method Null safety

Future<EtherScanRpcResponseModel> gasPrice ()

Returns the current price per gas in wei.

var gasprice = eth.gasPrice();

Implementation

Future<EtherScanRpcResponseModel> gasPrice() async {
  const module = 'proxy';
  const action = 'eth_gasPrice';
  Map<String, dynamic>? query = {
    'apiKey': apiKey,
    'module': module,
    'action': action,
  };

  return (await get(query)).fold(
    (l) => EtherScanRpcResponseModel.empty(),
    (r) => EtherScanRpcResponseModel.fromJson(r),
  );
}