FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
121 stars 18 forks source link

dependOnInheritedWidgetOfExactType Issue with a component #4039

Open launchInsighter opened 1 day ago

launchInsighter commented 1 day ago

Can we access your project?

Current Behavior

I ran my application in test mode. When I navigate to a page with a component, instead of showing the component, I get the error message below. I published my application to the web, and it worked fine in production. Also, I restored a working older version of my software, and it still showed the error, which led me to believe that it's related to your debugger.

I searched online for related FlutterFlow issues reported by other people. I found a similar issue, but it was no resolution.

This is now critical for me because I couldn't debug at all and I am launching my product next week. Please help.

dependOnInheritedWidgetOfExactType<DebugFlutterFlowModelContext>() or dependOnInheritedElement() was called before _RoleplayDialogueWidgetState.initState() completed. When an inherited widget changes, for example if the value of Theme.of() changes, its dependent widgets are rebuilt. If the dependent widget's reference to the inherited widget is in a constructor or an initState() method, then the rebuilt dependent widget will not reflect the changes in the inherited widget. Typically references to inherited widgets should occur in widget build() methods. Alternatively, initialization based on inherited widgets can be placed in the didChangeDependencies method, which is called after initState and whenever the dependencies change thereafter. at Object.throw_ [as throw] (errors.dart:296:3) at framework.dart:5720:9 at framework.StatefulElement.new.dependOnInheritedElement (framework.dart:5762:14) at framework.StatefulElement.new.dependOnInheritedWidgetOfExactType (framework.dart:4779:14) at DebugFlutterFlowModelContext.maybeOf (debug_util.dart:34:19) at get rootModel (flutter_flow_model.dart:93:38) at get isRouteVisible (flutter_flow_model.dart:98:40) at Object.debugLogWidgetClass (debug_util.dart:248:23) at set isRecording (roleplay_dialogue_model.dart:87:5) at roleplay_dialogue_widget._RoleplayDialogueWidgetState.new.<anonymous> (roleplay_dialogue_widget.dart:64:7) at Generator.next (<anonymous>) at runBody (async_patch.dart:84:54) at Object._async [as async] (async_patch.dart:127:5) at roleplay_dialogue_widget.dart:61:53 at [_invokeFrameCallback] (binding.dart:1392:7) at binding$5.WidgetsFlutterBinding.new.handleDrawFrame (binding.dart:1326:11) at [_handleDrawFrame] (binding.dart:1171:5) at Object.invoke (platform_dispatcher.dart:1404:5) at _engine.EnginePlatformDispatcher.new.invokeOnDrawFrame (platform_dispatcher.dart:307:5) at initialization.dart:187:36 at Object._checkAndCall (operations.dart:426:37) at Object.dcall (operations.dart:431:39) at ret (js_allow_interop_patch.dart:17:11)

Expected Behavior

The Test Mode component should appear as if it is in production.

Steps to Reproduce

  1. log in (use gmail to avoid sign up. but you can also sign up)
  2. go through "Get Started" and select a skill like Negotiation.
  3. go to home page (Home), click on the Negotiation tile.
  4. generate an idea.
  5. save the idea.
  6. run a simulation and you will see the error message. For a tutorial on how to run a simulation, you can check out here

Reproducible from Blank

Bug Report Code (Required)

IT4Cz8jfz49On7xE7q6Jc/lV+WAWHEw8RYEw1+xERkoYN5PND+x/esnRQFJuZ9OrdghiI1n8hT8K0PCJm9z1VMc5ByysG7Z9+KtidwLjUn25RaqDDM6CfHdUGshMGlzA1KangQknWdViSXwc2nGuC+iUcBDrN5TXIEUnMvyHEL7XrgfuQ0SLb3kNh1JWeC/v

Visual documentation

Screen with error in test mode.

Screenshot 2024-10-11 at 2 38 02 PM

Same screen in production.

Screenshot 2024-10-11 at 2 38 22 PM

Environment

- FlutterFlow version: 5.0.0
- Platform: Web
- Browser name and version:  Chrome
- Operating system and version affected: Sonoma 14.4.1

Additional Information

No response

MartinLockheart commented 1 day ago

Came here to see if this was reported yet. We really need this one fixed as well.

Edit For Additional Context: This seems to be related to having switches inside a component (and that appears to be the same with @launchInsighter as well).