Ömes Srn
·Analyze ● Create ● Inspire

Conditional Forwarding to another page

Hey there,
would be nice to get some input here, as I am getting errors and couldn't find something similar in de docs nor here in the community.

Goal

Have one url to link to a certain page showing a previously uploaded video
(e.g. on mydomain.com/showVideo?documentReference=3B8ao7swDZgyxRKP5uyR)

If that video doesn't exist, display a button to create a video behind this link.

Basic approach

I have a Firebase collection with a document,
storing the video_url of the uploaded video (on Firebase storage)
and the boolean videoExists.

My showVideo page has the documentReference as a Page Parameter.
It has a videoPlayer playing the Network video from the video_url.

Now I have a page action, that does a backend Call to
Read the Document on documentReference &
then decides on the videoExists boolean,
whether to stay on the showVideo page or Navigates To
the uploadVideo page
& passes the documentReference also as a Page Parameter.

The button on the uploadVideo page does a login if necessary
& saves the video to the given referenced document
(so that the uploadVideo page can store the video_url of the uploaded video to this document).

(videoExists = hasSnap
uploadVideo = createSnap)

Errors

Trying this I get an error, when I open
the showVideo page and there is no uploaded video
(in this case it should forward to the uploadVideo page).

The error says:
main.dart.js:4099 Uncaught Bad state: Future already completed

2 replies