Flutter: There are multiple heroes that share the same tag within a subtree异常
今天写Demo的时候遇到了下面的错误:
I/flutter: ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter: The following assertion was thrown during a scheduler callback:
I/flutter: There are multiple heroes that share the same tag within a subtree.
I/flutter: Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must
I/flutter: have a unique non-null tag.
I/flutter: In this case, multiple heroes had the following tag: <default FloatingActionButton tag>
I/flutter: Here is the subtree for one of the offending heroes:
I/flutter: # Hero(tag: <default FloatingActionButton tag>, state: _HeroState#c0b28)
...
大致意思是说:
在程序回调的的时候发生了以下断言:
在子树中有多个Hero 对象共用了一个tag,每个Hero对象的tag必须是惟一的。
并且指出了是FloatingActionButton
中的tag 有冲突。
以前都没注意到这个东西,来看一下FloatingActionButton 中的 tag吧。
可以看到 heroTag 有个默认值:<default FloatingActionButton tag>
而刚好我的页面中有两个 FloatingActionButton,所以就导致heroTag 冲突了。
解决办法很简单,给FloatingActionButton 的heroTag 赋一个新的值。
这样就可以正常使用了。
归根到底还是 Hero对象中的tag必须唯一,从下面报错的地方就可以看到了:
所以类似报错都可以直接找到有使用Hero对象的地方就行了。
Flutter: There are multiple heroes that share the same tag within a subtree异常相关推荐
- Flutter典型错误:There are multiple heroes that share the same tag within a subtree.
这段错误信息描述通常如下:'Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), ea ...
- Flutter笔记-There are multiple heroes that share the same tag within a subtree
在使用FloatingActionButton时报错了 floatingActionButton: Row(mainAxisAlignment: MainAxisAlignment.center,cr ...
- Flutter报错总结:There are multiple heroes that share the same tag within a subtree.
最近在项目中遇到了问题:点击每个页面都显示黑屏,并且控制台报错:There are multiple heroes that share the same tag within a subtree. ...
- There are multiple heroes that share the same tag within a subtree.
There are multiple heroes that share the same tag within a subtree. 情况一:报错由于FloatingActionButton的her ...
- Another exception was thrown: There are multiple heroes that share the same tag w
报错: I/flutter (18994): Another exception was thrown: There are multiple heroes that share the same t ...
- [译] Flutter 的 Heroes 和 Villains —— 为 Flutterverse 带来平衡
原文地址:Flutter Heroes and Villains - bringing balance to the Flutterverse. 原文作者:Norbert 译文出自:掘金翻译计划 本文 ...
- 给 iOS 开发者的 Flutter 指南
目录 Views 视图 What is the equivalent of a UIView in Flutter? UIView 相当于 Flutter 中的什么? How do I update ...
- 富文本中添加字体选项功能_扑中的字体功能
富文本中添加字体选项功能 A little extra help for styling your text 样式设置方面的一些额外帮助 I recently learned about a litt ...
- android hero动画,主动画 (Hero animations)
主动画 (Hero animations) 你将会在这里学到: What you'll learn Hero 指的是在屏幕间飞跃的 widget. The hero refers to the wid ...
最新文章
- RDB 和 AOF 持久化的原理是什么?我应该用哪一个?它们的优缺点?
- DataTables 表格固定栏使用方法
- Geospark-SQL加载SHP数据
- 正确使用cookie中的domain
- 区块链和java哪个更难_java 区块链中设计合理的难度系数
- Xilinx Vivado的使用详细介绍(1):创建工程、编写代码、行为仿真、Testbench
- 从机器学习到深度学习
- ERP系统各子系统功能模块页面
- 苹果手机数据线充不了电_自动洗地机充不了电,洗地机厂家
- mac foxmail html签名,Foxmail for mac邮箱账号添加设置图文教程
- 彻底关闭Adobe Flash Player的弹窗广告(不影响Flash正常使用)
- 利用callgrind+gprof2dot+dot进行性能分析
- 单片机C语言-include、sfr和sbit 的讲解
- latex 单元格 斜杠_如何在Excel中的单元格中启用键入斜杠
- class.forName
- seaborn seaborn色板的使用设置(二)
- 织梦模板下载:环保设计公司织梦模板
- 菲涅耳衍射,夫琅禾费衍射
- 美团点评java开发面试问题
- java properties 遍历_如何遍历properties文件的键值对并放置到application作用域里