getReleaseBundle method

  1. @override
Future<ReleaseBundle?> getReleaseBundle(
  1. String name,
  2. Version targetVersion, [
  3. String? platform
])
override

Gets a ReleaseBundle for the targetVersion.

Implementation

@override
Future<ReleaseBundle?> getReleaseBundle(String name, Version targetVersion,
    [String? platform]) async {
  var file = ReleaseBundle.formatReleaseBundleFile(
      releasesBundleFileFormat, name, targetVersion, platform);

  var body = await _getHttpPath(file);
  if (body == null) return null;

  var byteArray = body.asByteArray!;

  var zipBytes =
      byteArray is Uint8List ? byteArray : Uint8List.fromList(byteArray);

  var rootPath =
      file.replaceFirst(RegExp(r'\.zip$', caseSensitive: false), '');

  var release = Release(name, targetVersion, platform: platform);
  var releaseBundle =
      ReleaseBundleZip(release, zipBytes: zipBytes, rootPath: rootPath);

  return releaseBundle;
}