init static method

Future<void> init()

Implementation

static Future<void> init() async {
  String filePath = 'android/app/build.gradle';

  CreateFolderFiles.replaceLine(
    filePath: filePath,
    lineToReplace: 'compileSdkVersion',
    newLine: '    compileSdkVersion 34',
  );

  CreateFolderFiles.replaceLine(
    filePath: filePath,
    lineToReplace: 'minSdkVersion',
    newLine: '        minSdkVersion 22',
  );

  CreateFolderFiles.insertInFirstLine(
    filePath: 'android/build.gradle',
    newLine: '''
buildscript {
  repositories {
      google()
      jcenter()
  }
  dependencies {
      classpath 'com.google.gms:google-services:4.3.15'
  }
}
''',
  );

  CreateFolderFiles.addNewLine(
    filePath: filePath,
    refLine: 'id "dev.flutter.flutter-gradle-plugin"',
    newLine: '    id "com.google.gms.google-services"',
  );

  CreateFolderFiles.replaceLine(
    filePath: 'android/settings.gradle',
    lineToReplace: 'org.jetbrains.kotlin.android',
    newLine: 'id "org.jetbrains.kotlin.android" version "1.9.23" apply false',
  );

  LogService.success('Android files created successfully! 🎉');
}