Search code examples
flutterprogress-indicatorflutter-circularprogressindicator

How to show circular progress indicator while uploading image


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!);

Solution

  • 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; });});