You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i have this simple app that's using restorationScopeId. as i have figure out after hours of debugging that restorationScopeId causes OneContext not initiated exception
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] UnhandledException:'package:one_context/src/controllers/one_context.dart':Failed assertion: line 16 pos 12:'_context != null':OneContext not initiated! please use builder method.
You need to use the OneContext().builder function to be able to show dialogs and overlays! e.g. ->MaterialApp(
builder:OneContext().builder,
...
)
If you already set the OneContext().builder early, maybe you are probably trying to use some methods that will only be available after the first MaterialApp build.
OneContext needs to be initialized by MaterialApp before it can be used in the application. This error exception occurs whenOneContext context has not yet loaded and you try to use some method that needs the context, such as the showDialog, dismissSnackBar, showSnackBar, showModalBottomSheet, showBottomSheet or popDialog methods.
If you need to use any of these OneContext methods before defining the MaterialApp, a safe way is to check if the OneContext context has already been initialized.
e.g.
```dart
if (OneContext.hasContext) {OneContext().showDialog (...);}
Hi, i have this simple app that's using
restorationScopeId
. as i have figure out after hours of debugging thatrestorationScopeId
causes OneContext not initiated exceptionFlutter version: 3.19.0
log
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 OneContext.context (package:one_context/src/controllers/one_context.dart:16:12)
#3 OneContext.hasContext (package:one_context/src/controllers/one_context.dart:20:46)
#4 OneThemeController.loadThemeMode (package:one_context/src/controllers/one_theme_controller.dart:81:20)
The text was updated successfully, but these errors were encountered: