[go: nahoru, domu]

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

Inspector service not working due to null location. #88898

Closed
nilotpalkapri opened this issue Aug 25, 2021 · 2 comments
Closed

Inspector service not working due to null location. #88898

nilotpalkapri opened this issue Aug 25, 2021 · 2 comments
Labels
r: invalid Issue is closed as not valid

Comments

@nilotpalkapri
Copy link

#84423

Steps to Reproduce

Step 1: Add dependency:: reorderables: ^0.4.1

Step 2: Put the below wrap inside a scrollable body:
List photos = []; //Put some photos inside the list

final size = MediaQuery.of(context).size;
var wrap = ReorderableWrap(
    alignment: WrapAlignment.spaceEvenly,
    buildDraggableFeedback: (context, constraints, widget) => widget,
    spacing: 0.0,
    runSpacing: 10.0,
    padding: EdgeInsets.all(0),
    children: photos.map((file) =>
        Container(
          height: size.height/2.3,
          width: size.width/2.3,
          child: Stack(alignment: AlignmentDirectional.center,
            children:[
              Container(
                child: Image.file(
                  file,
                  fit: BoxFit.cover,
                ),
              ),
              Container(
                color:Colors.transparent,
                child: Column(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children:[
                      Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children:[
                            Container(
                              width: 30,
                              height: 30,
                              alignment: Alignment.center,
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(50),
                              ),
                              child: IconButton(
                                padding: const EdgeInsets.all(0.0),
                                icon: Icon(Icons.add_a_photo_outlined,
                                ),
                                onPressed: () {},
                              ),
                            ),
                          ]),
                    ]),
              ),
            ]),
        ),
    ).toList(),
    onReorder: (int oldIndex, int newIndex){},
    onNoReorder: (int index) {},
    onReorderStarted: (int index) {}
);

Step 3: Try dragging photos:

#84423

  1. Run flutter create bug.
  2. Update the files as follows: ...
  3. ...

Expected results:

Actual results:
The error is throwing due to the IconButton class because without "child: IconButton(
padding: const EdgeInsets.all(0.0),
icon: Icon(Icons.add_a_photo_outlined,
),
onPressed: () {},
)," in the given code no issue is there.

Logs ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following _TypeError was thrown building Container(Alignment.center, bg: BoxDecoration(borderRadius: BorderRadius.circular(50.0)), constraints: BoxConstraints(w=30.0, h=30.0)): type 'Null' is not a subtype of type 'String' of 'function result'

The relevant error-causing widget was:
Container file:///home/nilotpalkapri/Desktop/Project/Android_App/xxxxxx/lib/xxxx.dart:462:33

When the exception was thrown, this was the stack:
#0 _Location.file (package:flutter/src/widgets/widget_inspector.dart)
#1 _Location.toJsonMap (package:flutter/src/widgets/widget_inspector.dart:2844:15)
#2 _Location.toJsonMap. (package:flutter/src/widgets/widget_inspector.dart:2853:42)
#3 MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#4 ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#5 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#6 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#7 new List.of (dart:core-patch/array_patch.dart:50:28)
#8 ListIterable.toList (dart:_internal/iterable.dart:212:44)
#9 _Location.toJsonMap (package:flutter/src/widgets/widget_inspector.dart:2854:9)
#10 InspectorSerializationDelegate.additionalNodeProperties (package:flutter/src/widgets/widget_inspector.dart:3169:53)
#11 DiagnosticsNode.toJsonMap. (package:flutter/src/foundation/diagnostics.dart:1593:21)
#12 DiagnosticsNode.toJsonMap (package:flutter/src/foundation/diagnostics.dart:1608:6)
#13 DiagnosticsProperty.toJsonMap (package:flutter/src/foundation/diagnostics.dart:2694:45)
#14 DiagnosticsNode.toJsonList. (package:flutter/src/foundation/diagnostics.dart:1632:19)
#15 MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#16 ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#17 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#18 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#19 new List.of (dart:core-patch/array_patch.dart:50:28)
#20 ListIterable.toList (dart:_internal/iterable.dart:212:44)
#21 DiagnosticsNode.toJsonList (package:flutter/src/foundation/diagnostics.dart:1633:8)
#22 DiagnosticsProperty.toJsonMap (package:flutter/src/foundation/diagnostics.dart:2688:36)
#23 DiagnosticsNode.toJsonList. (package:flutter/src/foundation/diagnostics.dart:1632:19)
#24 MappedListIterable.elementAt (dart:_internal/iterable.dart:412:31)
#25 ListIterator.moveNext (dart:_internal/iterable.dart:341:26)
#26 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:188:27)
#27 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#28 new List.of (dart:core-patch/array_patch.dart:50:28)
#29 ListIterable.toList (dart:_internal/iterable.dart:212:44)
#30 DiagnosticsNode.toJsonList (package:flutter/src/foundation/diagnostics.dart:1633:8)
#31 DiagnosticsNode.toJsonMap. (package:flutter/src/foundation/diagnostics.dart:1595:25)
#32 DiagnosticsNode.toJsonMap (package:flutter/src/foundation/diagnostics.dart:1608:6)
#33 WidgetInspectorService._nodeToJson (package:flutter/src/widgets/widget_inspector.dart:1499:18)
#34 WidgetInspectorService._reportError (package:flutter/src/widgets/widget_inspector.dart:919:44)
#35 FlutterError.reportError (package:flutter/src/foundation/assertions.dart:1107:14)
#36 _debugReportException (package:flutter/src/widgets/framework.dart:6276:16)
#37 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4583:9)
#38 Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
#39 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4553:5)
#40 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4548:5)
... Normal element mounting (16 frames)
#56 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#57 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
#58 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6232:32)
#59 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#60 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
#61 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6232:32)
... Normal element mounting (10 frames)
#71 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#72 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
#73 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6232:32)
... Normal element mounting (45 frames)
#118 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#119 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
#120 Element.updateChild (package:flutter/src/widgets/framework.dart:3363:18)
#121 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5654:32)
#122 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6243:17)
#123 Element.updateChild (package:flutter/src/widgets/framework.dart:3350:15)
#124 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4599:16)
#125 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4746:11)
#126 Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
#127 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2582:33)
#128 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:875:21)
#129 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
#130 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#131 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#132 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
#136 _invoke (dart:ui/hooks.dart:163:10)
#137 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
#138 _drawFrame (dart:ui/hooks.dart:126:31)
(elided 3 frames from dart:async)

════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4269 pos 14: 'owner!._debugCurrentBuildTarget == this': is not
true.

Another exception was thrown: type 'Null' is not a subtype of type 'String' of 'function result'

Another exception was thrown: Cannot hit test a render box that has never been laid out.

Another exception was thrown: Cannot hit test a render box that has never been laid out.

    • Flutter version 2.2.3 at /home/nilotpalkapri/snap/flutter/common/flutter
    • Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

⣷[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /home/nilotpalkapri/Android/Sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /snap/android-studio/114/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 4.2)
    • Android Studio at /snap/android-studio/113/android-studio
    • Flutter plugin version 58.0.1
    • Dart plugin version 202.8531
    • Java version OpenJDK Runtime Environment (build 11.0.8+0-b944-P17168821)

[✓] Android Studio (version 2020.3)
    • Android Studio at /snap/android-studio/114/android-studio
    • Flutter plugin version 59.0.2
    • Dart plugin version 203.8292
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Connected device (3 available)
    • Redmi Note 5 Pro (mobile) • 46f54288 • android-arm64  • Android 9 (API 28)
    • Linux (desktop)           • linux    • linux-x64      • Linux
    • Chrome (web)              • chrome   • web-javascript • Google Chrome 92.0.4515.159

• No issues found!
@nilotpalkapri
Copy link
Author

Found the solution in channel beta.

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown building IconButton(Icon, padding: EdgeInsets.zero, dirty):
No Material widget found.
IconButton widgets require a Material widget ancestor.
In material design, most widgets are conceptually "printed" on a sheet of material. In Flutter's
material library, that material is represented by the Material widget. It is the Material widget
that renders ink splashes, for instance. Because of this, many material library widgets require that
there be a Material widget in the tree above them.
To introduce a Material widget, you can either directly include one, or use a widget that contains
Material itself, such as a Card, Dialog, Drawer, or Scaffold.
The specific widget that could not find a Material ancestor was:
IconButton
The ancestors of this widget were:
...
Align
DecoratedBox
ConstrainedBox
Container
Row
...

The relevant error-causing widget was:

So, putting IconButton inside Card solved the issue.

@danagbemava-nc danagbemava-nc added in triage Presently being triaged by the triage team r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team labels Aug 26, 2021
@github-actions
Copy link
github-actions bot commented Sep 9, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

2 participants