flutter_dotenv icon indicating copy to clipboard operation
flutter_dotenv copied to clipboard

When Flutter app in background, env file data not importing

Open SamarpanCoder2002 opened this issue 2 years ago • 1 comments

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.

SamarpanCoder2002 avatar Jun 20 '22 06:06 SamarpanCoder2002

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");

FlawLessx avatar Sep 06 '22 06:09 FlawLessx