Try to make a Event Photo Booth app

Hi

I trying to make a Event Photo Booth app.
It should show a live preview of the camera, there should be a button to take a picture, and afterwards the taken picture should be displayed. The pictures that are taken must of course be saved. I have actually, after this video, made a live preview, button to take a picture. https://www.youtube.com/watch?v=gX7PWIvYS6E

I can get everything in the video to work, but it doesn't show uploading the captured image.
the owners of the video have shared this Action, which should be used to upload image, but do not tell how to use it.
I can't get this Action to work, don't know how to use it.

this is what the owner of the video writes

you have to create 1 more custom action, to upload base64 file to your own firestore. this is my custom code:

import 'package:firebase_storage/firebase_storage.dart';
Future<String?> base64Upload(String base64image) async {
  // upload base64 image to firebase storeage

  // Decode the base64 image
  Uint8List bytes = base64.decode(base64image);

  // Create a unique file name
  String fileName = DateTime.now().millisecondsSinceEpoch.toString() + ".jpg";

  // Upload the image to Firebase Storage
  Reference ref = FirebaseStorage.instance.ref().child(fileName);
  UploadTask uploadTask = ref.putData(bytes);
  TaskSnapshot taskSnapshot = await uploadTask.whenComplete(() => null);

  // Get the download URL of the uploaded image
  // String downloadUrl = await taskSnapshot.ref.getDownloadURL();
  final downloadUrl = await taskSnapshot.ref.getDownloadURL();
  return downloadUrl;
}


I have of course tried to contact the owner of the video, but he does not answer.


Can anyone help with how I can save the images?

2