configureDotenv function

Future<void> configureDotenv()

Implementation

Future<void> configureDotenv() async {
  try {
    await dotenv.load(fileName: '.env');

    //const elements = [Constants.contractAddress, Constants.polygonApiKey];
    //if (!dotenv.isEveryDefined(elements)) {
    if (dotenv.env[Constants.polygonApiKey] == null) {
      throw const DotenvException(
          'WorkenSdk | Empty API key, please set [polygonApiKey] in file [.env]'
          'You can get it from https://polygonscan.com/apis');
    }
  } catch (e) {
    throw const DotenvException(
        "WorkenSdk | Create file [.env] to configure sdk");
  }
}