I am using environment variables for testing (username and password).
I have my .env file setup.
I also have the flutter_dotenv imported in my test file as per:
https://pub.dev/packages/flutter_dotenv
However, under "Using in tests #" it mentions using the method testLoad to load a static set of variables for testing.
The document also offers 2 examples:
Example 1: Loading from a static string.
dotenv.testLoad(fileInput: '''FOO=foo
BAR=bar
''');
Example 2: Loading from a file synchronously.
dotenv.testLoad(fileInput: File('test/.env').readAsStringSync());
Can someone explain how these examples work?
In Example 1, it seems the testLoad method would return all variables listed in .env in a single call.
So I have a USERNAME=Bobby and a PASSWORD=1234 in my .env file.
If I use testLoad it would return both Bobby and 1234.
However, I don't want to get both variables at once. When I test my app, I need to select the field "username" to input the username and afterwards, select the field "password" to input the password; I don't want to input both variables in a single field.
Am I missing something? What use is there for both variables to come in at once?
I also do not understand the use for Example 2 at all.