dotenv icon indicating copy to clipboard operation
dotenv copied to clipboard

Flutter Web incompatible

Open tomassasovsky opened this issue 2 years ago • 2 comments

I'm trying to run this on flutter web, and getting this error message in the console:

Flutter Web Bootstrap: Auto
Error: Unsupported operation: _Namespace
    at Object.throw_ [as throw] (http://localhost:56952/dart_sdk.js:5080:11)
    at get _namespace [as _namespace] (http://localhost:56952/dart_sdk.js:56681:17)
    at io._File.new.existsSync (http://localhost:56952/dart_sdk.js:54545:51)
at [_verify] (http://localhost:56952/packages/dotenv/src/dotenv.dart.lib.js:83:14)
at dotenv.DotEnv.new.load (http://localhost:56952/packages/dotenv/src/dotenv.dart.lib.js:75:34)
at http://localhost:56952/packages/comic_book_explorer/main_development.dart.lib.js:39:10
at main (http://localhost:56952/packages/comic_book_explorer/main_development.dart.lib.js:41:7)
at http://localhost:56952/web_entrypoint.dart.lib.js:34:33
    at Object._checkAndCall (http://localhost:56952/dart_sdk.js:5279:16)
    at Object.dcall (http://localhost:56952/dart_sdk.js:5284:17)
    at http://localhost:56952/dart_sdk.js:140291:18
    at Generator.next (<anonymous>)
    at http://localhost:56952/dart_sdk.js:40641:33
    at _RootZone.runUnary (http://localhost:56952/dart_sdk.js:40511:59)
    at _FutureListener.thenAwait.handleValue (http://localhost:56952/dart_sdk.js:35438:29)
    at handleValueCallback (http://localhost:56952/dart_sdk.js:35999:49)
    at _Future._propagateToListeners (http://localhost:56952/dart_sdk.js:36037:17)
    at [_completeWithValue] (http://localhost:56952/dart_sdk.js:35872:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:56952/dart_sdk.js:35906:35)
    at Object._microtaskLoop (http://localhost:56952/dart_sdk.js:40778:13)
    at _startMicrotaskLoop (http://localhost:56952/dart_sdk.js:40784:13)
    at http://localhost:56952/dart_sdk.js:36261:9

Is there any way to fix this?

tomassasovsky avatar Jun 08 '22 12:06 tomassasovsky

Dotenv use dart:io, so can't be compatible this package with web Screenshot 2022-06-28 at 11 53 41

Try use flutter_dotenv

mdeandrea-mrmilu avatar Jun 28 '22 09:06 mdeandrea-mrmilu

I'm using flutter_dotenv but can't use it on Web to. Any solution? When I deploy web app, it doesn't load .env and return 404 con Chrome console. Any advice?

roquemolina avatar Dec 11 '23 16:12 roquemolina