getBuildGradleKey function
String
getBuildGradleKey(
- String key, {
- FileSystem? fs,
- Directory? workingDir,
})
Implementation
String getBuildGradleKey(String key, {FileSystem? fs, Directory? workingDir}) {
final _fs = fs ?? const LocalFileSystem();
final wd = getCurrentDir(workingDir, fs: _fs).path;
final buildFile = _fs.file(
path.join(wd, 'android', 'app', 'build.gradle'),
);
logger.debug('Getting $key from ${buildFile.path}');
final value = buildFile
.readAsStringSync()
.split('\n')
.firstWhere((x) => x.trim().startsWith(key))
.trim()
.split(' ')
.last;
return value;
}