NoSuchMethodError List.reversed with web_ui and latest Dart SDK

Issue

Following along with the tutorial at http://www.dartlang.org/docs/tutorials/web-ui/, I’ve just implemented the first example and tried to build.

Build command:

$DART_SDK/bin/dart --package-root=packages/ packages/web_ui/dwc.dart index.html

with SDK version 17072 gives stack trace

SEVERE index.html: exception while reading file, original message:
 AsyncError: 'NoSuchMethodError : method not found: 'reversed'
Receiver: GrowableObjectArray
Arguments: []'
Stack trace:
#0      Object._noSuchMethod (dart:core-patch:1689:3)
#1      Object.noSuchMethod (dart:core-patch:1690:25)
#2      ListProxy.reversed (package:html5lib/src/list_proxy.dart:76:33)
#3      TreeBuilder.elementInScope (package:html5lib/src/treebuilder.dart:134:36)
#4      InBodyPhase.startTagHeading (package:html5lib/parser.dart:1393:28)
#5      InBodyPhase.processStartTag (package:html5lib/parser.dart:1118:31)
#6      HtmlParser.mainLoop (package:html5lib/parser.dart:333:48)
#7      HtmlParser._parse (package:html5lib/parser.dart:214:17)
#8      HtmlParser._parse (package:html5lib/parser.dart:216:9)
#9      HtmlParser.parse (package:html5lib/parser.dart:193:11)
#10     parseHtml (packages/web_ui/src/compiler.dart:35:30)
#11     Compiler._parseHtmlFile.<anonymous closure>.<anonymous closure> (packages/web_ui/src/compiler.dart:165:28)
#12     time (packages/web_ui/src/utils.dart:38:24)
#13     Compiler._time (packages/web_ui/src/compiler.dart:297:16)
#14     Compiler._parseHtmlFile.<anonymous closure> (packages/web_ui/src/compiler.dart:164:32)
#15     _ThenFuture._sendValue (dart:async:353:24)

Solution

17072 is quite an old (in Dart years) build – the current version (at time of writing) downloadable at http://www.dartlang.org/downloads.html is 17657, and this change log which added List.reversed was committed in r17402

Answered By – Chris Buckett

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *