runInIos method

Future<void> runInIos()

Implementation

Future<void> runInIos() async {
  final iosConfigFile = File(iosConfigPath);
  if (!await iosConfigFile.exists()) {
    throw Exception('iOS配置文件不存在');
  }
  final lineTexts = await iosConfigFile.readAsLines();
  for (int i = 0; i < lineTexts.length; i++) {
    if (lineTexts[i].contains('FLUTTER_BUILD_NAME')) {
      lineTexts[i] = 'FLUTTER_BUILD_NAME = ${environment.buildName}';
    } else if (lineTexts[i].contains('FLUTTER_BUILD_NUMBER')) {
      lineTexts[i] = 'FLUTTER_BUILD_NUMBER = ${environment.buildNumber}';
    }
  }
  await iosConfigFile.writeAsString(lineTexts.join('\n'));
}