You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import 'dart:math'; //used for the random number generator
import 'package:dart_web3/dart_web3.dart';
// You can create Credentials from private keys
Credentials fromHex = EthPrivateKey.fromHex("c87509a[...]dc0d3");
// Or generate a new key randomly
var rng = Random.secure();
Credentials random = EthPrivateKey.createRandom(rng);
// In either way, the library can derive the public key and the address
// from a private key:
var address = await credentials.extractAddress();
print(address.hex);
However, in my dart application, this creates errors.
I modified some of the content, but it still gets an error:
import 'package:dart_web3/dart_web3.dart';
import 'package:http/http.dart';
import 'dart:math'; //used for the random number generator
// Or generate a new key randomly
var rng = Random.secure();
final EthPrivateKey credentials = EthPrivateKey.createRandom(rng);
var address = await credentials.extractAddress();
//print(address.hex);
My changes solves for the type errors for credentials. But I still get an await error saying its missing async.
Error: 'address.hex' can't be used as a type because 'address' doesn't refer to an import prefix
The text was updated successfully, but these errors were encountered:
timfong888
changed the title
going through examples -- getting errors
going through examples -- getting errors ('address' doesn't refer to an import prefix)
May 30, 2022
This is from the example documentation:
However, in my dart application, this creates errors.
I modified some of the content, but it still gets an error:
My changes solves for the type errors for credentials. But I still get an await error saying its missing async.
Error: 'address.hex' can't be used as a type because 'address' doesn't refer to an import prefix
The text was updated successfully, but these errors were encountered: