Created
November 20, 2020 17:01
-
-
Save Jonas-Sander/0a586af3e2bcb2957b686bc5cb673d34 to your computer and use it in GitHub Desktop.
Add dart language comment "// @Dart=2.10" to top of dart files.
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.10 | |
import 'dart:io'; | |
import 'package:glob/glob.dart'; | |
Future<void> main() async { | |
final replacements = | |
Glob('**.dart').list().asyncMap((fileSystemEntity) async { | |
if (fileSystemEntity is File) { | |
final content = await fileSystemEntity.readAsString(); | |
await fileSystemEntity.writeAsString('// @dart = 2.10\n$content'); | |
} | |
}); | |
await replacements.last; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment