I want to pass an environment variable to a flutter drive
test.
Being able to read the value in the launched application or the test code would both be fi
The .env package serves me well:
include:
import 'package:dotenv/dotenv.dart' show load, env;
load:
load();
use:
test('can log in', () async {
await driver.tap(emailFieldFinder);
await driver.enterText(env['USERNAME']);
await driver.tap(passwordFieldFinder);
await driver.enterText(env['PASSWORD']);
await driver.tap(loginButtonFinder);
await Future.delayed(Duration(seconds: 2));
expect(await driver.getText(mainMessageFinder), "Welcome");
});