getFileFromBase64 method

Future<File?> getFileFromBase64({
  1. required String base64string,
  2. required String name,
  3. required String extension,
})

this function convert base64 to file with 3 inputs base64 string , name for comming file, and extension

Implementation

Future<File?> getFileFromBase64(
    {required String base64string,
    required String name,
    required String extension}) async {
  final decodedBytes = base64Decode(base64string);
  Directory tempdirectory = await pp.getTemporaryDirectory();

  File file = File("${tempdirectory.path}/${name}.${extension}");
  file.writeAsBytes(decodedBytes);
  return file;
}