-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileNotFoundError #72
Comments
@jerinho, have you added the reference to your flutter:
[...]
assets:
- .env where Otherwise, check if your name is other than await dotenv.load(fileName: ".env.yourName"); I hope that helps. |
You probably put the .env file inside of the lib folder. Instead, you should put it into the root directory one layer above. |
I have the same problem. Project structure .env TWITTER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXX
TWITTER_API_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX pubspec.yaml dependencies:
flutter:
sdk: flutter
#...
flutter_dotenv: ^5.0.2
#...
assets:
- assets/icons/
- .env main.dart WidgetsFlutterBinding.ensureInitialized();
DartPluginRegistrant.ensureInitialized();
await dotenv.load(
fileName: ".env",
);
runApp(
StoreProvider(
store: appStore,
child: const MyAppName(),
),
); A curious fact is that I ran the exact same code a few days ago on Linux and it worked, just like when I came to Windows. As much as I believe this did not influence, I thought it best to say this. |
Some issue, I fix add this: assets: |
This issue in general is because the I think this behavior could be different depending on the operative system. I made my tests on macOS Ventura using flutter web. |
Saved Much Time. Thanks |
E/flutter (29283): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Instance of 'FileNotFoundError'
E/flutter (29283): #0 DotEnv._getEntriesFromFile (package:flutter_dotenv/src/dotenv.dart:98:7)
E/flutter (29283):
E/flutter (29283): #1 DotEnv.load (package:flutter_dotenv/src/dotenv.dart:65:27)
E/flutter (29283):
E/flutter (29283): #2 main (package:menu/main.dart:12:3)
E/flutter (29283):
E/flutter (29283):
The text was updated successfully, but these errors were encountered: