Skip to content

Instantly share code, notes, and snippets.

@aam
Last active November 12, 2020 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aam/20ad773feb6cc35142875f9ba96ae45c to your computer and use it in GitHub Desktop.
Save aam/20ad773feb6cc35142875f9ba96ae45c to your computer and use it in GitHub Desktop.
// @dart = 2.9
import 'dart:io';
import 'dart:isolate';
import 'dart:async';
import 'package:path/path.dart' as p;
void main(List<String> arguments) async {
// var a = <int?>[];
// print("root: can use NNBD");
// print('root: NNBD is ${<int?>[] is! List<int>? "strong": "weak"}');
Directory tmp = await Directory.systemTemp.createTemp("testCopy");
var path = "${tmp.path}/other.dart";
var sourceFile = new File(path);
sourceFile.writeAsStringSync(r"""
void main() {
var a = <int?>[];
print("child: can use NNBD");
print('child: NNBD is ${<int?>[] is! List<int>? "strong": "weak"}');
}
""");
var exitPort = new ReceivePort();
await Isolate.spawnUri(p.toUri(p.absolute(path)), [], null,
onExit: exitPort.sendPort);
await exitPort.first;
await sourceFile.delete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment