patch method

  1. @override
Future<void> patch(
  1. Release release,
  2. {void onProgress(
    1. double progress
    )?}
)
override

Downloads and installs a given release.

Use onProgress to get the progress of the download in percent. progress is a value between 0 and 1.

Throws an UnsupportedError if canPatch returns false.

Implementation

@override
Future<void> patch(
  Release release, {
  void Function(double progress)? onProgress,
}) async {
  final setup = await downloadService.download(
    release.downloads.windows,
    "$kAppName Setup ${release.versionString}.exe",
    onProgress: (_, __, progess) => onProgress?.call(progess),
  );

  await Process.start(setup.absolute.path, []);

  exit(0);
}