deploy method

dynamic deploy(
  1. String zipFileName,
  2. Function callback
)

Implementation

deploy(String zipFileName, Function callback) async {
  Directory appDir = await getApplicationDocumentsDirectory();

  /// External Store ???
  String contentPath = appDir.path + '/scorm_store';

  final Directory httpDirectory =
      await Directory('${appDir.path}/www').create(recursive: true);
  final VirtualDirectory staticFiles = VirtualDirectory(httpDirectory.path)
    ..allowDirectoryListing = true;
  _httpDirectory = httpDirectory;

  await ZipFileRF().unzip('$contentPath/$zipFileName',
      '${_httpDirectory!.path}', 'content', false);
  await ZipFileRF().unzip('lib.zip', '${_httpDirectory!.path}/', '', true);

  File indexFile = File('${_httpDirectory!.path}/scorm12.html');
  String indexContent = await rootBundle.loadString('assets/scorm12.txt');
  await indexFile.writeAsString(indexContent);

  callback(host);
}