updateCompileSdkVersion static method

Future<void> updateCompileSdkVersion()

Implementation

static Future<void> updateCompileSdkVersion() async {
  final File buildGradle = File('android/app/build.gradle');
  String content = buildGradle.readAsStringSync();

  String oldValue = 'compileSdkVersion flutter.compileSdkVersion';
  String newValue = 'compileSdkVersion 34';

  content = content.replaceAllMapped(
    RegExp(oldValue),
    (match) => newValue,
  );
  buildGradle.writeAsStringSync(content);
}