ethPrice method Null safety

Future<EtherScanPriceModel> ethPrice ()

Returns the price of ether now

Example

var price = eth.ethprice();

Implementation

Future<EtherScanPriceModel> ethPrice() async {
  const module = 'stats';
  const action = 'ethprice';

  Map<String, dynamic>? query = {
    'module': module,
    'action': action,
    'apiKey': apiKey,
  };

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