Reputation: 103
import 'dart:io';
main()
{
stdout.write('hi, ');
stdout.write('hello');
}
// Unable to use the stdout,write() on dart Io Pad ? //Uncaught Error: Unsupported operation: StdIOUtils._getStdioOutputStream
Upvotes: 0
Views: 2098
Reputation: 1906
By using the direct print() method (Support to Dartpad)
void main() {
for(int i = 0; i < 5; i++){
print('Text ' * i);
}
}
Output:
Text
Text Text
Text Text Text
Text Text Text Text
Example for when multiplying by 0, 1, 2
void main() {
print('Text' * 1);
print('Text' * 0);
print('Text' * 2);
}
Output:
Text
TextText
Upvotes: 1
Reputation: 11702
You're getting this error because DartPad does not support dart:io
.
Also, DartPad does not support libraries from packages. DartPad supports dart:*
libraries that work with web apps.
If you want to use dart:io
you'll need to install Dart SDK on your computer or on a virtual machine on the cloud.
https://dart.dev/tools/dartpad#library-support
Upvotes: 2