assetToExternalStorage method
Implementation
Future<File> assetToExternalStorage(String filename) async {
ByteData byteData = await rootBundle.load('assets/$filename');
// this creates the file image
Directory appDir = await getApplicationDocumentsDirectory();
var _path = appDir.path + '/www';
File file = await File('$_path/$filename').create(recursive: true);
// copies data byte by byte
await file.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
return file;
}