简体   繁体   English

Flutter 范围错误:无效值:....,包含:-1

[英]Flutter Range Error : Invalid value: ...., Inclusive: -1

What does "Inclusive: -1" mean in a Range Error RangeError (index): Invalid Value: Not in range 0..6, inclusive: -1 “包含:-1”在范围错误中是什么意思RangeError (index): Invalid Value: Not in range 0..6, inclusive: -1

Note: index is the argument from注意:索引是来自的参数

ListView.builder(
  itemBuilder: (context,index) => Widget,
)

The misleading comma is causing you to misparse the error message.误导性逗号导致您错误地解析错误消息。 The "inclusive" part is meant to describe the range, not the invalid value. “包含”部分用于描述范围,而不是无效值。 That is, the error would have been better written as:也就是说,错误最好写成:

RangeError (index): Invalid Value: -1 not in range 0..6 (inclusive)

or要么

RangeError (index): Invalid Value: -1 not in range [0, 6]

Somewhere you're passing -1 as an index into a list that has 7 elements.在某个地方,您将 -1 作为索引传递到具有 7 个元素的列表中。

( https://github.com/dart-lang/sdk/issues/29586 requests that the error message be improved.) https://github.com/dart-lang/sdk/issues/29586请求改进错误信息。)

I was able to fix it by going to the projects root directory and running the command我能够通过转到项目根目录并运行命令来修复它

flutter clean

... I was experiencing the issue on iOS. ...我在 iOS 上遇到了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter 错误:RangeError (index): Invalid value: Not in range 0..2, inclusive: 3 - Flutter Error: RangeError (index): Invalid value: Not in range 0..2, inclusive: 3 范围错误索引无效值不在范围内,dart flutter 应用程序中的 0..1 包括 2 - Range error index invalid value not in range, 0..1 inclusive 2 in dart flutter app RangeError (index): Invalid value: Not in range 0..3, inclusive: 4 in Flutter - RangeError (index): Invalid value: Not in range 0..3, inclusive: 4 in Flutter 颤振范围错误(索引):无效值:不在包含范围内 0..4:CarouselSlider 上的 5 - flutter RangeError (index): Invalid value: Not in inclusive range 0..4: 5 on CarouselSlider RangeError (index): Invalid value: Not in inclusive range 0..13: 14 Flutter - RangeError (index): Invalid value: Not in inclusive range 0..13: 14 Flutter RangeError(索引):无效值:不在0..5范围内(包括6):Flutter SliverChildBuilderDelegate - RangeError (index): Invalid value: Not in range 0..5, inclusive: 6 : Flutter SliverChildBuilderDelegate Flutter:RangeError(索引):无效值:不在包含范围 0..27:28 - Flutter : RangeError (index): Invalid value: Not in inclusive range 0..27: 28 RangeError(索引):无效值:不在 0..2 范围内,包括:3 - RangeError (index): Invalid value: Not in range 0..2, inclusive: 3 RangeError(索引):无效值:不在包含范围内 0..5:-5 - RangeError (index): Invalid value: Not in inclusive range 0..5: -5 RangeError(索引):无效值:不在包含范围内 0..1:收藏某个项目时为 2 - RangeError (index): Invalid value: Not in inclusive range 0..1: 2 when favoriting an item
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM