globe
globe copied to clipboard
Workaround [dotenv] Load failed: file not found: File: '.env'
For future readers:
package:dotenv tries to read .env file form the file system, but we only deploy dart executable without any files.
If you deploy from CLI, it will pick up your .env and prompt you to create env vars on Globe.
You could also go to Project > Settings > Environment variables and create env vars there manually.
To workaround this issue, you could do something like this:
var env = Platform.environment['GLOBE'] == 'true' ? Platform.environment : DotEnv().load();
We're working on fixing this issue and this workaround is temporary.