getBundleId method

  1. @override
Future<String?> getBundleId()
override

Fetches the bundle ID from the Linux my_application.cc file.

Returns: Future<String?>, the bundle ID if found, null otherwise.

Implementation

@override
Future<String?> getBundleId() async {
  final filePath = linuxAppCppPath;
  var contentLineByLine = await readFileAsLineByline(
    filePath: filePath,
  );
  for (var i = 0; i < contentLineByLine.length; i++) {
    if (contentLineByLine[i]?.contains('kFlutterWindowTitle') ?? false) {
      var match = RegExp(r'kFlutterWindowTitle = "(.*?)"')
          .firstMatch(contentLineByLine[i]!);
      return match?.group(1)?.trim();
    }
  }
  return null;
}