How to show circular progress indicator while uploading image

888 Views Asked by At

I'm new on flutter this is my code.

final ref = FirebaseStorage.instance
            .ref()
            .child('users')
            .child(widget.user.uid)
            .child('$clotheId.jpg');
        await ref.putFile(_pickedImage!);
1

There are 1 best solutions below

3
sahilatahar On BEST ANSWER

Declare an variable bool isUploaded = false; And apply condition that isUploaded ? Text("Uploded Succesful") : CircularProcessIndicator(),

In which method you are uploading then set:

final ref = 
    FirebaseStorage.instance
    .ref()
    .child('users')
    .child(widget.user.uid)
    .child('$clotheId.jpg');
    await ref.putFile(_pickedImage!).then((value) {setState((){isUploaded = true; });});