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

Env file not readable in an isolate #105

Open
ciprianteletin opened this issue Jul 4, 2024 · 0 comments
Open

Env file not readable in an isolate #105

ciprianteletin opened this issue Jul 4, 2024 · 0 comments

Comments

@ciprianteletin
Copy link

Hi, currently I am running flutter_dotenv 5.1.0, with dart --version 3.1.5
Inside my isolate code, I am calling dotenv.load(file) since I need in my process some of the environment variables defined in the file. The error does not appear if I remove the dotenv.load(file) call from the isolate.

The error is the following:

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: UI actions are only available on root isolate.
#0 FfiTrampoline____nativeSetNeedsReportTimings$Method$FfiNative$Ptr (dart:ffi)
#1 PlatformDispatcher.__nativeSetNeedsReportTimings (dart:ui/platform_dispatcher.dart:588:24)
#2 PlatformDispatcher._nativeSetNeedsReportTimings (dart:ui/platform_dispatcher.dart:585:52)
#3 PlatformDispatcher.onReportTimings= (dart:ui/platform_dispatcher.dart:577:29)
#4 SchedulerBinding.addTimingsCallback (package:flutter/src/scheduler/binding.dart:308:26)
#5 SchedulerBinding.initInstances (package:flutter/src/scheduler/binding.dart:240:7)
#6 ServicesBinding.initInstances (package:flutter/src/services/binding.dart:37:11)
#7 PaintingBinding.initInstances (package:flutter/src/painting/binding.dart:20:11)
#8 SemanticsBinding.initInstances (package:flutter/src/semantics/binding.dart:18:11)
#9 RendererBinding.initInstances (package:flutter/src/rendering/binding.dart:29:11)<…>

I see that the load method is calling WidgetsFlutterBinding.ensureInitialized() in the background which is causing the error from above.

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

1 participant