appName property

String? get appName

The application name.

This is read from the window.CreateAndShow or window.Create line in the windows/runner/main.cpp file.

Implementation

static String? get appName {
  final file = File(join('windows', 'runner', 'main.cpp'));
  final lines = file.readAsLinesSync();
  final line = lines.firstWhere(
    (line) =>
        line.contains('window.CreateAndShow') ||
        line.contains('window.Create'),
    orElse: () => '',
  );
  final match = RegExp(r'(CreateAndShow|Create)\(L"(.*?)"').firstMatch(line);
  return match?.group(2)?.trim();
}