Reputation: 3539
Somehow I could not build my very first Dart web components example. The project is very simple and taken from Seth blog.
First the build.dart
file should be places in root folder of the project (not in web/
folder) <- is that true ?
Here is the code:
Project
\--ui
\-- test_component.html
<!DOCTYPE html>
<html lang="en">
<body>
<element name="x-click-counter" constructor="CounterComponent" extends="div">
<template>
<button on-click="increment()">Click me</button>
<span>(click count: {{count}})</span>
</template>
<script type="application/dart" src="test_component.dart"></script>
</element>
<!-- more below... -->
</body>
</html>
\-- test_component.dart
library test_component;
import 'package:web_ui/web_ui.dart';
class CounterComponent extends WebComponent
{
int count = 0;
void increment(e)
{
count++;
}
}
\-- web
\-- index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="components" href="ui/test_component.html">
<title>Dart • TodoMVC</title>
</head>
<body>
<x-click-counter></x-click-counter>
<script type="application/dart">main() {}</script>
</body>
</html>
\-- build.dart
import 'dart:io';
import 'packages/web_ui/component_build.dart';
void main()
{
build(new Options().arguments, ['web/index.html']);
}
Just after I moved build.dart
to root folder strange error occurred:
--- 00:51:50 01/04/2013 build.dart --machine --changed=web\index.html --- file:/C:/Projects/ProtonUiComponents/build.dart build.dart returned error code 255
Uncaught Error: Class '_File' has no instance method 'open' with matching arguments.
NoSuchMethodError: incorrect number of arguments passed to method named 'open' Receiver: Instance of '_File@0x1da10ec4' Tried calling: open(mode: Instance of 'FileMode') Found: open(mode) Stack Trace:
#0 Object.noSuchMethod (dart:core-patch:1884:25)
#1 ConsoleFileSystem.writeString (file:///C:/Projects/ProtonUiComponents/packages/web_ui/src/file_system/console.dart:22:43)
#2 writeFile (file:///C:/Projects/ProtonUiComponents/packages/web_ui/dwc.dart:103:27)
#3 emitFiles.<anonymous closure> (file:///C:/Projects/ProtonUiComponents/packages/web_ui/dwc.dart:91:35)
#4 List.forEach (dart:core-patch:1219:8)
#5 emitFiles (file:///C:/Projects/ProtonUiComponents/packages/web_ui/dwc.dart:91:18)
#6 run.<anonymous closure>.<anonymous closure> (file:///C:/Projects/ProtonUiComponents/packages/web_ui/dwc.dart:85:29)
#7 _ThenFuture._sendValue (dart:async:463:24)
#8 _FutureImpl._setValue (dart:async:361:26)
#9 _FutureListenerWrapper._sendValue (dart:async:221:21)
#10 _FutureImpl._setValue (dart:async:361:26)
#11 _FutureImpl._setOrChainValue (dart:async:437:16)
#12 _ThenFuture._sendValue (dart:async:473:21)
#13 _FutureImpl._setValue (dart:async:361:26)
#14 _FutureListenerWrapper._sendValue (dart:async:221:21)
#15 _FutureImpl._setValue (dart:async:361:26)
#16 _FutureImpl._setOrChainValue (dart:async:437:16)
#17 _ThenFuture._sendValue (dart:async:473:21)
#18 _FutureImpl._setValue (dart:async:361:26)
#19 _CompleterImpl.complete (dart:async:190:21)
#20 _FutureImpl._FutureImpl.wait.<anonymous closure> (dart:async:273:29)
#21 _ThenFuture._sendValue (dart:async:463:24)
#22 _FutureImpl._setValue (dart:async:361:26)
#23 _CatchErrorFuture._sendValue (dart:async:485:14)
#24 _FutureImpl._setValue (dart:async:361:26)
#25 Stream.reduce.<anonymous closure> (dart:async:699:23)
If I run build.dart
manually I receive and error in dwc.dart
:
type 'ConsoleFileSystem' is not a subtype of type 'FileSystem' of 'fileSystem'.
then the index.html
could no be run at all (not in Dartium nor in Javascript) with Dart Editor error:
What I'm doing wrong ?
Update:
Upvotes: 0
Views: 239
Reputation: 8128
Current editor version (as of 1st of April 2013) is 20602. Updating to the newest version should fix it.
http://dartlang.org/docs/editor
Upvotes: 1