buildFile function

Future buildFile({
  1. required String command,
  2. required String paltform,
})

打包文件

Implementation

Future buildFile({required String command, required String paltform}) async {
  try {
    printSuccessMessage('开始编译 $projectName $paltform\n');
    final process = await Process.start(
      'flutter',
      ['build', command, '--release'],
      workingDirectory: projectPath,
      runInShell: true,
    );
    process.stdout.transform(utf8.decoder).listen((data) => printMessage(data));
    process.stderr.transform(utf8.decoder).listen((data) => printErrorMessage(data));
    await process.exitCode;
    printSuccessMessage('$projectName $paltform 编译完成\n');
  } catch (e) {
    printErrorMessage('打包 $paltform 异常:$e');
  }
}