Last active
November 12, 2020 19:36
-
-
Save aam/20ad773feb6cc35142875f9ba96ae45c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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