flutter - RangeError(长度):无效值:只有有效值是 0:1. 抛出错误 'ErrorDescription' 的实例
问题描述
我们刚刚发布了我们的应用程序。并且在生产中看到了这些崩溃。但是堆栈跟踪并没有引导我到有用的地方。
RangeError (length): Invalid value: 只有有效值是 0: 1. Error throwed Instance of 'ErrorDescription
Non-fatal Exception: FlutterError
0 ??? 0x0 first (dart:core)
1 ??? 0x0 assembleSemanticsNode + 436 (paragraph.dart:436)
2 ??? 0x0 compileChildren + 3717 (object.dart:3717)
3 ??? 0x0 compileChildren + 3709 (object.dart:3709)
4 ??? 0x0 compileChildren + 3709 (object.dart:3709)
5 ??? 0x0 compileChildren + 3709 (object.dart:3709)
6 ??? 0x0 compileChildren + 3709 (object.dart:3709)
7 ??? 0x0 compileChildren + 3709 (object.dart:3709)
8 ??? 0x0 compileChildren + 3709 (object.dart:3709)
9 ??? 0x0 compileChildren + 3709 (object.dart:3709)
10 ??? 0x0 compileChildren + 3663 (object.dart:3663)
11 ??? 0x0 compileChildren + 3709 (object.dart:3709)
12 ??? 0x0 compileChildren + 3587 (object.dart:3587)
13 ??? 0x0 _updateSemantics + 2631 (object.dart:2631)
14 ??? 0x0 flushSemantics + 1081 (object.dart:1081)
15 ??? 0x0 drawFrame + 441 (binding.dart:441)
16 ??? 0x0 drawFrame + 914 (binding.dart:914)
17 ??? 0x0 _handlePersistentFrameCallback + 302 (binding.dart:302)
18 ??? 0x0 _invokeFrameCallback + 1117 (binding.dart:1117)
19 ??? 0x0 handleDrawFrame + 1055 (binding.dart:1055)
20 ??? 0x0 _handleDrawFrame + 971 (binding.dart:971)
重现步骤
我无法重现该问题。我在 Firebase 中看到了这些崩溃。
日志No problems with the analyzer
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H114 darwin-x64, locale en-BE)
• Flutter version 1.22.6 at /Users/vanlooverenkoen/fvm/versions/stable
• Framework revision 9b2d32b605 (5 weeks ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/vanlooverenkoen/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0.1, Build version 12A7300
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[!] IntelliJ IDEA Community Edition (version 2020.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[!] VS Code (version 1.53.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
解决方案
在我们的例子中,我们有一个带有可点击文本跨度的富文本。
这导致了一个问题。
https://github.com/flutter/flutter/issues/69787 https://github.com/flutter/flutter/issues/51936
更新到颤振 2.0.0 以获得潜在的修复
颤振前 2.0.0 的解决方法:
ExcludeSemantics(
excluding: true,
child: RichText( ... ),
),
推荐阅读
- c# - 统一构建游戏后tcp网络无法正常工作
- tensorflow - 导出经过训练的推理图 TENSERFLOW
- python - 为什么 FunctionTransformer 会通过 check_inverse?
- javascript - 如何复制部分
文本点击
- kotlin - 从 KotlinJS 通过 web3 调用合约
- amazon-web-services - 无效的模板资源属性“Fn::Base64”
- opencart2.x - 它不适用于 cart.tpl - Opencart 2.2
- mysql - 如何在 MySQL 中存储时间 UTC?
- c++ - 每次使用宏时获取不同的值
- android - Flowable 未从 Room DB 返回值