Skip to content
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

Error: FileNotFoundError on fluter project with module #89

Open
romulogomesbsi opened this issue Jul 10, 2023 · 4 comments
Open

Error: FileNotFoundError on fluter project with module #89

romulogomesbsi opened this issue Jul 10, 2023 · 4 comments

Comments

@romulogomesbsi
Copy link

romulogomesbsi commented Jul 10, 2023

I'm working on a flutter project with Module. This package doesn't work correctly here, but if I build a normal project, I don't get this error.

E/flutter (27891): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Instance of 'FileNotFoundError' E/flutter (27891): #0 DotEnv._getEntriesFromFile dotenv.dart:111 E/flutter (27891): <asynchronous suspension> E/flutter (27891): #1 DotEnv.load dotenv.dart:68 E/flutter (27891): <asynchronous suspension> E/flutter (27891): #2 main main.dart:9 E/flutter (27891): <asynchronous suspension> E/flutter (27891):

@Dev-Ayan-Dasgupta
Copy link

Did you include .env in pubspec.yaml under assets?

@neeraj15022001
Copy link

Screenshot 2023-08-10 at 1 15 29 AM

Facing same issue when running Flutter on web, though i haven't tried on other platforms.

Pubspec.yaml
Screenshot 2023-08-10 at 1 17 11 AM
I have added env to assets as told in docs

@jsmile
Copy link

jsmile commented Aug 18, 2023

I have the same trouble:

E/flutter (28853): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Instance of 'FileNotFoundError'

- my pubspec.yaml

name: open_weather_cubit
description: A Flutter BLoC - OpenWeather Cubit project.

publish_to: 'none' 

version: 1.0.0+1

environment:
  sdk: '>=3.1.0 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  equatable: ^2.0.5
  flutter_bloc: ^8.1.3
  flutter_dotenv: ^5.1.0
  http: ^1.1.0
  recase: ^4.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true

assets:
  - assets/images/loading.gif
  - .env
  • I made '.env' file in the project root.
  • I have loaded in a flutter app
void main() async {
  await dotenv.load(fileName: '.env');
  runApp(const MyApp());
}  

@beibeigd
Copy link

beibeigd commented Dec 8, 2023

I tried to solve it like this in windows.
.env file cannot be empty.

pubspec.yaml

flutter:
  assets:
    - .env

×

flutter:
assets:
  - .env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants