insertChunkCalled function

Future<void> insertChunkCalled()

Implementation

Future<void> insertChunkCalled() async {
  final rootPath = Directory.current.path;

  final indexPath = '$rootPath/build/web/index.html';
  final indexFile = File(indexPath);
  var indexFileStr = await indexFile.readAsString();

  print(indexFileStr);

  indexFileStr = indexFileStr.replaceFirst('</body>', '''

  <script>
${resources.get_chunks}
  </script>
</body>
''');

  await File(indexPath).writeAsString(indexFileStr);

  print('chunks methods added in index.html');
}