Comparing Dart expressions in Dart

Here is a little experiment.

You’ll ship Dart supply code by means of knowledge URL to isolates to execute the code. There will have to be a `major` serve as that will get a `SendPort` you’ll use to ship again knowledge to the caller. That you must additionally prohibit the programs that remoted code has get entry to to however I did not hassle.

Long term<dynamic> eval(String supply) async {
ultimate uri = Uri.dataFromString(
“import ‘dart:isolate’;void major(_, SendPort port) => port.ship($supply);”,
encoding: utf8,
mimeType: ‘software/octet-stream’,
);
ultimate port = ReceivePort();
wait for Isolate.spawnUri(uri, [], port.sendPort);
go back port.first;
}

void major() async {
stdout.write(‘dart> ‘);
ultimate line = stdin.readLineSync();
if (line == null) go back;
print(wait for eval(line));
}



View Reddit by way of eibaanView Supply

You may also like...

WP2Social Auto Publish Powered By : XYZScripts.com