getBlockReward method Null safety
Find the block reward for a given address and block
address
- Address of the block
blockno
- Block number
Implementation
Future<EtherScanBlockRewardModel> getBlockReward({
String? address,
Object? blockno = 0,
}) async {
const module = 'block';
const action = 'getblockreward';
final query = {
'module': module,
'action': action,
'apiKey': apiKey,
};
if (address != null) {
query.putIfAbsent('address', () => address);
}
if (blockno != null) {
query.putIfAbsent('blockno', () => '$blockno');
}
return (await get(query)).fold(
(l) => EtherScanBlockRewardModel.empty(),
(r) => EtherScanBlockRewardModel.fromJson(r),
);
}