4

What is proper usage of stdout() function from package io in dart? I wrote such a script:

#import('dart:io');
void main() {
  print("Hello World");
  stdout();
}

and I get following output:

firen@firen-VirtualBox:~/Downloads$ ./dart/dart-sdk/bin/dart ./dart/workspace/test/text.dart Hello world Unhandled exception: Object is not closure 0. Function: '::main' url: '/home/firen/Downloads/dart/workspace/test/text.dart' line:6 col:7

firen
  • 1,384
  • 2
  • 14
  • 32

1 Answers1

7
import 'dart:io';
void main() {
     String s = "Hello World";
     stdout.write(s.charCodes());
}

stdout is a property of type OutputStream rather than method, which is why you get the "Object is not a closure" error when you try to call stdout();

Chris Buckett
  • 13,738
  • 5
  • 39
  • 46