openBase64File function

Future<void> openBase64File(
  1. String base64String,
  2. String fileName
)

Implementation

Future<void> openBase64File(String base64String, String fileName) async {
  // Decode Base64 string to bytes
  final bytes = base64Decode(base64String);

  // Get the temporary directory
  final directory = await getTemporaryDirectory();

  // Create a file in the temporary directory
  final file = File('${directory.path}/$fileName');

  // Write the bytes to the file
  await file.writeAsBytes(bytes);

  // Open the file using open_file package
  await OpenFile.open(file.path);
}