- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我看到这个错误 '_elements.contains(element)': is not true。
过去两天在我的 flutter 项目中,它从一开始就工作得非常好。很抱歉这么说,但我对这个错误一无所知,但我想我错过了导致这个错误的东西。此外,当我热重新加载同一页面时,布局已填充,但会引发异常。
间歇性地,这也显示检测到 Duplicate GlobalKeys(),但一开始并非如此。
如果有人以前偶然发现这些错误,请帮助我。我真的不能写一个例子来重现同样的问题。非常感谢。
我已经给出错误的详细信息如下:
Performing hot reload...
I/flutter (22248): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY
╞═══════════════════════════════════════════════════════════
I/flutter (22248): The following assertion was thrown building
TickerMode(mode: disabled):
I/flutter (22248): 'package:flutter/src/widgets/framework.dart': Failed
assertion: line 1766 pos 12:
I/flutter (22248): '_elements.contains(element)': is not true.
I/flutter (22248):
I/flutter (22248): Either the assertion indicates an error in the framework
itself, or we should provide substantially
I/flutter (22248): more information in this error message to help you
determine and fix the underlying cause.
I/flutter (22248): In either case, please report this assertion by filing a
bug on GitHub:
I/flutter (22248): https://github.com/flutter/flutter/issues/new
I/flutter (22248):
I/flutter (22248): When the exception was thrown, this was the stack:
I/flutter (22248): #2 _InactiveElements.remove
(package:flutter/src/widgets/framework.dart:1766:12)
I/flutter (22248): #3 Element._retakeInactiveElement
(package:flutter/src/widgets/framework.dart:2850:29)
I/flutter (22248): #4 Element.inflateWidget
(package:flutter/src/widgets/framework.dart:2873:32)
I/flutter (22248): #5 Element.updateChild
(package:flutter/src/widgets/framework.dart:2688:12)
I/flutter (22248): #6 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #7 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #8 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #9 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #10 RenderObjectElement.updateChildren
(package:flutter/src/widgets/framework.dart:4262:32)
I/flutter (22248): #11 _TheatreElement.update
(package:flutter/src/widgets/overlay.dart:508:17)
I/flutter (22248): #12 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #13 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #14 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #15 StatefulElement.update
(package:flutter/src/widgets/framework.dart:3682:5)
I/flutter (22248): #16 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #17 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #18 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #19 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #20 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #21 SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:4535:14)
I/flutter (22248): #22 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #23 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #24 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #25 StatefulElement.update
(package:flutter/src/widgets/framework.dart:3682:5)
I/flutter (22248): #26 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #27 SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:4535:14)
I/flutter (22248): #28 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #29 SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:4535:14)
I/flutter (22248): #30 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #31 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #32 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #33 StatefulElement.update
(package:flutter/src/widgets/framework.dart:3682:5)
I/flutter (22248): #34 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #35 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #36 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #37 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #38 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #39 SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:4535:14)
I/flutter (22248): #40 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #41 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #42 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #43 StatelessElement.update
(package:flutter/src/widgets/framework.dart:3607:5)
I/flutter (22248): #44 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #45 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #46 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #47 StatelessElement.update
(package:flutter/src/widgets/framework.dart:3607:5)
I/flutter (22248): #48 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #49 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #50 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #51 StatelessElement.update
(package:flutter/src/widgets/framework.dart:3607:5)
I/flutter (22248): #52 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #53 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #54 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #55 StatelessElement.update
(package:flutter/src/widgets/framework.dart:3607:5)
I/flutter (22248): #56 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #57 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #58 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #59 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #60 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #61 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #62 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #63 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #64 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #65 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #66 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #67 StatefulElement.update
(package:flutter/src/widgets/framework.dart:3682:5)
I/flutter (22248): #68 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #69 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #70 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #71 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #72 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #73 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #74 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #75 StatefulElement.update
(package:flutter/src/widgets/framework.dart:3682:5)
I/flutter (22248): #76 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #77 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #78 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #79 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #80 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #81 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #82 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #83 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #84 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #85 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #86 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #87 StatelessElement.update
(package:flutter/src/widgets/framework.dart:3607:5)
I/flutter (22248): #88 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #89 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #90 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #91 StatefulElement.update
(package:flutter/src/widgets/framework.dart:3682:5)
I/flutter (22248): #92 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #93 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #94 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #95 ProxyElement.update
(package:flutter/src/widgets/framework.dart:3792:5)
I/flutter (22248): #96 Element.updateChild
(package:flutter/src/widgets/framework.dart:2677:15)
I/flutter (22248): #97 ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:3557:16)
I/flutter (22248): #98 Element.rebuild
(package:flutter/src/widgets/framework.dart:3446:5)
I/flutter (22248): #99 BuildOwner.buildScope
(package:flutter/src/widgets/framework.dart:2246:33)
I/flutter (22248): #100
BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&Renderer
Binding&WidgetsBinding.drawFrame
(package:flutter/src/widgets/binding.dart:580:20)
I/flutter (22248): #101
BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&Renderer
Binding._handlePersistentFrameCallback
(package:flutter/src/rendering/binding.dart:200:5)
I/flutter (22248): #102
BindingBase&SchedulerBinding._invokeFrameCallback
(package:flutter/src/scheduler/binding.dart:713:15)
I/flutter (22248): #103 BindingBase&SchedulerBinding.handleDrawFrame
(package:flutter/src/scheduler/binding.dart:649:9)
I/flutter (22248): #104
BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&Renderer
Binding.scheduleWarmUpFrame.<anonymous closure>
(package:flutter/src/rendering/binding.dart:286:20)
I/flutter (22248): #106 _Timer._runTimers (dart:isolate-
patch/dart:isolate/timer_impl.dart:367)
I/flutter (22248): #107 _Timer._handleMessage (dart:isolate-
patch/dart:isolate/timer_impl.dart:401)
I/flutter (22248): #108 _RawReceivePortImpl._handleMessage
(dart:isolate-patch/dart:isolate/isolate_patch.dart:163)
I/flutter (22248): (elided 3 frames from class _AssertionError and
package dart:async-patch)
I/flutter (22248):
══════════════════════════════════════════════════════════════════════════
══════════════════════════
Reloaded 0 of 492 libraries in 823ms.
我在我的应用程序中包含了一个示例示例。
主.dart
import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart';
import 'package:untitled3/secondwidget.dart';
void main() {
runApp(
new Example(),
);
}
class Example extends StatefulWidget {
@override
_ExampleState createState() => new _ExampleState();
}
class _ExampleState extends State<Example> {
int noOfBranches;
@override
void initState() {
super.initState();
getCount();
}
void getCount() {
print('list builder count is ${noOfBranches}');
}
@override
Widget build(BuildContext context) {
setState(() {
noOfBranches = 2;
});
return new MaterialApp(
home: new Scaffold(
body: new ListView.builder(
itemCount: noOfBranches,
itemBuilder: (BuildContext context, int index) {
return new Card(
child: new FlatButton(
onPressed: (() {
Navigator.push(
context,
new MaterialPageRoute(
builder: (_) => new SecondWidget()));
}),
child: new Text('Next Widget')),
);
}),
),
);
}
}
secondwidget.dart
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class SecondWidget extends StatefulWidget {
@override
_SecondWidgetState createState() => new _SecondWidgetState();
}
class _SecondWidgetState extends State<SecondWidget> {
@override
Widget build(BuildContext context) {
return new Container(
child: new Text('Second Widget'),
);
}
}
如果 setState()
按照示例 main.dart 文件中给出的方式声明
@override
Widget build(BuildContext context) {
setState(() {
noOfBranches = 2;
});
.....
}
但如果我在 getCount()
函数中声明 setState()
,我只会看到此错误。
我不太确定为什么会这样。
我实际上被这个错误困住了两天,非常感谢任何帮助。
非常感谢,鲯鳅鱼
最佳答案
我想我通过在
中声明setState()
解决了这个错误
@override
Widget build(BuildContext context) {
setState(() {
noOfBranches = 2;
});
print('noof branches inside widget build = $noOfBranches');
.....
}
现在应用程序运行得非常好,没有任何问题。但是,如果有更多建议,我将不胜感激,因为我是编程新手,并且非常乐意了解更多信息。唯一的问题是 setState()
正在修改上下文,当单击按钮调用另一个小部件时,它会抛出此错误消息。
非常感谢,鲯鳅鱼。
关于dart - 错误 : '_elements.contains(element)' : is not true,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46728408/
下面两个CSS选择器有什么区别? 来自解释here ,它们听起来一样吗? div p{} 选择div元素内的所有p元素 div > p{} 选择父级为 div 元素的所有 p 元素。 最佳答案 区别在
我需要怎么做: 目前,事实证明: 我更喜欢它看起来像: 最佳答案 有了这些空行,看起来您的 select 语句是(正确地)选择您
用替换元素是否有效至 .在这种情况下,我想要, 这样我就可以在...中附加验证数据。这也可以从 中实现吗?或 等等? 最佳答案 标签没有 而且不需要一个。同样适用于 和 .您可以将验证数据作为
我刚刚发现了 Angular 1.2.1 的一个奇怪问题,在 this fiddle 中进行了演示。 (在 IE、FF 和 Chrome 中测试):如果我创建一个非常简单的模板化指令,它无法像 那样
我正在尝试使用 Jsoup 迭代 java 中的两个元素,但是,我收到运行时异常错误。看来我无法将nodes.Element 的类型转换为element.Element。 非常感谢您的帮助,谢谢。 代
假设我的文档中有一组元素,它们是单个对象的子元素。这些元素中的每一个都使用不同的参数注册一个新的事件监听器。如果我丢弃父对象,是否需要手动取消注册所有 eventListener?或者浏览器是否跟踪所
我不应该在我的应用程序中使用 jQuery,但我有一个场景,我需要元素的偏移量,而不是使用 $(element).offset() 我已经使用了 angular.element(element).of
我是TS的新手,我想知道为什么我在以下代码中遇到类型错误(简化):。错误在`{iconMap[名称]}中:。“元素隐式具有‘any’类型,因为‘字符串’类型的表达式不能用于索引类型‘{Categori
我是TS的新手,我想知道为什么我在以下代码中遇到类型错误(简化):。错误在`{iconMap[名称]}中:。“元素隐式具有”any“类型,因为”string“类型的表达式不能用于索引类型”{ Cate
什么意思: Separator.Iterator.Element == Self.Iterator.Element.Iterator.Element 在this (Swift 标准库)swift 实例
是否可以在 img 元素上使用前后伪选择器?认为它是但没有任何运气,将 css 切换到 div 并且它工作正常。 .page-overhang 类是 img 元素。 // page overhang
我在 UI 中的按钮 Click 事件上有以下代码,它返回一个 MS-Excel 文件。它在第一次点击事件中完美运行,但之后返回以下错误。 任何建议,我怎样才能摆脱它? ERROR: Uncaught
如何在 CSS 中编写这个想法: 选择 ElementA 内但不在 ElementB 内且 ElementB 在 ElementA 内的每个元素。 这是一个例子:
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
如果我在 C# 中的 XElement myXML 变量中有以下 XML, myvalue 要获得“myvalue”,我需要执行以下操作: myXML.Element(
我找不到用户名和密码字段。我检查元素,并尝试通过 id、xpath 或 css 选择器查找它,但它给出错误 NoSuchElementException: Message: no such eleme
我的任务是在用户点击它时从输入框中删除占位符并使标签可见。如果用户未在其中再次填写任何内容,请放回占位符并使标签不可见。 我可以隐藏它但不能重新分配它。我试过 element.setAttribute
我正在编写一个 c# 类来编写一个 XML 文件,该文件需要与我们使用的现有 XML 的结构完全匹配,这样一些遗留系统就不会混淆。 当一个元素的InnerText值为null时,我需要xml元素的元素
自定义元素的一个常见做法,至少在 Polymer(最流行的 Web 组件框架)中,是定义一个新的自定义元素。恕我直言,这对 来说不是一个好习惯呈现 元素,因为该元素无法逐步呈现,必须等到它被加载(注册
我正在尝试跟踪元素的可见性及其显示的控制台错误:“元素“a[data-vars-ei]”必须是 AMP 元素”。 但是在点击跟踪的情况下,类似的事情工作正常。 我无法理解为什么会发生这种情况以及我应该
我是一名优秀的程序员,十分优秀!