flutter_dotenv
flutter_dotenv copied to clipboard
When Flutter app in background, env file data not importing
static Key _key =
Key.fromBase64(DataManagement.getEnvData(EnvFileKey.encryptKey) ?? '');
That's how I am importing env file data(encryptKey in this case). It works fine normally but does not import data while the app is in the background.
If possible, please fix this.
because background service is creating separate isolate from flutter app, you need to initialize first on your background service function, example:
await dotenv.load(fileName: ".env");