readTursoSharedAppName function
Reads the package name from pubspec.yaml in the current directory.
カレントディレクトリのpubspec.yamlからパッケージ名を読み取ります。
Implementation
String readTursoSharedAppName() {
final pubspec = File("pubspec.yaml");
if (!pubspec.existsSync()) {
return "";
}
final match = RegExp(r"^name:\s*([A-Za-z0-9_]+)\s*$", multiLine: true)
.firstMatch(pubspec.readAsStringSync());
return match?.group(1) ?? "";
}