Abdelazeem777 / requests_inspector

MIT License
11 stars 18 forks source link

HideInspectorBunner crashes app if child widget is MyApp #24

Closed LynxLynxx closed 10 months ago

LynxLynxx commented 10 months ago

Hi, when I try to use hideInspectorBanner the app crashes and gives error that no Directionality widget was found. I am guessing that since RequestInspector wraps MyApp which has MaterialApp widget inside it dosent get information about screen and widget placement in side widget tree.

runApp(
    RequestsInspector(
      enabled: true,
      hideInspectorBanner: true,
      child: MyApp(),
    ),
  );
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building PageView(dirty, state:
_PageViewState#93311(scrollDirection: horizontal, PageController#baa59(no clients),
NeverScrollableScrollPhysics)):
No Directionality widget found.
PageView widgets require a Directionality widget ancestor.
The specific widget that could not find a Directionality ancestor was:
  PageView
The ownership chain for the affected widget is: "PageView ← Listener ← _GestureSemantics ←
  RawGestureDetector ← GestureDetector ← WillPopScope ← Builder ←
  _InheritedProviderScope<InspectorController?> ← ChangeNotifierProvider<InspectorController> ←
  RequestsInspector ← ⋯"
Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the
top of your application widget tree. It determines the ambient reading direction and is used, for
example, to determine how to lay out text, how to interpret "start" and "end" values, and to resolve
EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.

The relevant error-causing widget was:
  RequestsInspector
  RequestsInspector:file:///Users/ryszardschossler/Developer/Paidwork/paidwork-flutter/flutter_app/lib/main.dart:52:5

image

LynxLynxx commented 10 months ago

I see that PR#22 solves this issue but on pub.dev in version ^3.2.1 doesn't have implemented this solution.

Abdelazeem777 commented 10 months ago

Hi, @LynxLynxx

Could you please try to add requests_inspector to your pubspec.yaml like the following:

requests_inspector: 3.2.1

And let me know if the issue still exists

LynxLynxx commented 10 months ago
Because requests_inspector >=2.5.0 depends on hasura_connect ^4.0.0+4 which depends on http ^0.13.0, requests_inspector >=2.5.0 requires http ^0.13.0.
So, because flutter_app depends on both http ^1.0.0 and requests_inspector 3.2.1, version solving failed.

so vs code added version 2.4.0 because of other dependencies. So I modified the library myself and the solution in PR#22 works!

As I work on a really large project I cannot really update all of the dependencies to the latest versions.

Abdelazeem777 commented 10 months ago

To be honest hasura_connect package is kinda headache for me. And I am already thinking of removing its support from the package at all

Abdelazeem777 commented 10 months ago

hasura_connect is fully removed in the new version v3.3.0

requests_inspector: 3.3.0

Please check the new version and let me know if you still facing any other problems.

I am closing this issue for now, but don't hesitate to open it again 😊