loadEnv static method

Future<void> loadEnv({
  1. String filename = '.env',
})

Initialize .env file (call this in your app's main function)

Example:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await AppHubUpgrader.initialize();
  runApp(MyApp());
}

Or with custom filename:

await AppHubUpgrader.initialize(filename: '.env.production');

Implementation

static Future<void> loadEnv({String filename = '.env'}) async {
  try {
    await dotenv.load(fileName: filename);
  } catch (e) {
    // .env file not found, will use default values
    // This is fine for packages that may not have .env
  }
}