addAndroidPermissions function

String addAndroidPermissions(
  1. Context context,
  2. String manifestFileData,
  3. List<String> permissionList
)

Implementation

String addAndroidPermissions(Context context, String manifestFileData, List<String> permissionList) {
  final parsed = XmlDocument.parse(manifestFileData);
  final application = parsed.findAllElements("manifest").toList()[0];

  permissionList.forEach((item) =>
      application.children.add(buildPermissionNode(item))
  );
  return parsed.toXmlString(pretty: true);
}