getBlock method

Future<Block> getBlock(
  1. int blockNumber
)

Get the Block from the network by blockNumber, where the Block.transactions is a list of transaction hashes.


final block = await provider!.getBlock(2000000);

print(block);
// Block: 2000000 0x9d2e2d20 mined at 2020-11-06T21:22:24.000 with diff 2
print(block.transaction.first);
// 0x99598d22288ba2ed229cf965a7e0279a8df3d61d48f779d2ce5e3ab84788c10c

Implementation

Future<Block> getBlock(int blockNumber) async =>
    Block._(await call<_BlockImpl>('getBlock', [blockNumber]));