getFunctionSelector static method
Gets the 4-byte function selector from a signature. Per Solidity ABI specification, the signature is UTF-8 encoded before hashing.
Implementation
static Uint8List getFunctionSelector(String signature) {
final hash = Keccak256.hash(Uint8List.fromList(utf8.encode(signature)));
return BytesUtils.slice(hash, 0, 4);
}