I am working on a Web3 Flutter website (just to learn flutter).
I would like to programmatically know if there is an extension installed or not (Metamask in this case).
In the documentation they say that I can check if Metamask is installed by checking if window.ethereum != undefined
(in JS).
Obviously, I don't have this property in the Window object of flutter.. Is there a variable that list all unknown properties or something like that?
Thanks!
you can use this plugin https://pub.dev/packages/flutter_web3
there is a property that you can use as
/ `Ethereum.isSupported` is the same as `ethereum != null`
if (ethereum != null) {
try {
// Prompt user to connect to the provider, i.e. confirm the connection modal
final accs = await ethereum!
.requestAccount(); // Get all accounts in node disposal
accs; // [foo,bar]
} on EthereumUserRejected {
print('User rejected the modal');
}
}