【问题标题】:RangeError (length): Invalid value: Only valid value is 0: 1. Error thrown Instance of 'ErrorDescription'RangeError(长度):无效值:只有有效值是 0:1. 抛出错误 'ErrorDescription' 的实例
【发布时间】:2021-02-24 12:58:31
【问题描述】:

我们刚刚发布了我们的应用程序。并且在生产中看到了这些崩溃。但是堆栈跟踪并没有把我带到有用的地方。

RangeError (length): Invalid value: Only valid value is 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

【问题讨论】:

  • 我认为,您应该分享导致错误的代码,以便我们可以更好地帮助您。
  • 这就是问题,我不知道这个错误是从哪里引起的。我在 firebase 生产中遇到了这个错误。
  • 也许在 ListView 之类的。您必须提供长度参数作为输入。
  • 我在想也许它与空的空文本有关?因为paragraph.dart 文件。但我在那里也找不到任何东西
  • 好吧,您可以做的不是共享整个代码,而是注释部分代码并测试您的应用程序。这样,您也可以找到导致 Widget 的错误。然后,您可以在这里分享,以便我们确定原因。

标签: flutter dart crashlytics


【解决方案1】:

在我们的例子中,我们有一个带有可点击文本跨度的富文本。

这导致了一个问题。

https://github.com/flutter/flutter/issues/69787 https://github.com/flutter/flutter/issues/51936

更新到 Flutter 2.0.0 以进行潜在修复

flutter 2.0.0 之前的解决方法:

ExcludeSemantics(
  excluding: true,
  child: RichText( ... ),
),

【讨论】:

    猜你喜欢
    • 2021-03-02
    • 1970-01-01
    • 2021-08-02
    • 2020-10-31
    • 2020-08-04
    • 1970-01-01
    • 2021-06-16
    • 2021-07-31
    • 1970-01-01
    相关资源
    最近更新 更多