title: flutter state change on
body: <pre><code>class _EventAdminEditState extends State&lt;EventAdminEdit&gt; {
  
    @override
    Widget build(BuildContext context) {
     String imageURL = widget.ccaDocument['Image'];
      final GlobalKey&lt;FormState&gt; _key = GlobalKey();
  
      final TextEditingController imageURLController = new TextEditingController();
      imageURLController.text = imageURL;
      
  
  
      void _publishEvent() async {
        print(imageURL);
        widget.ccaDocument.reference.updateData({
          'Name' : name,
          'Details': details,
          'Location': location,
          'RegisterInstructions': registrationInstructions,
          'EventTime': eventTime,
          'Image' : imageURL
          
                            
    }
    
  
  Future uploadImage(BuildContext context) async {
    final picker = ImagePicker();
    final pickedFile = await picker.getImage(source: ImageSource.gallery);
    setState(() {
      _image = File(pickedFile.path);
    });
    StorageReference firebaseStorageRef = FirebaseStorage.instance
        .ref()
        .child('event_profile/${Path.basename(_image.path)}}');
    StorageUploadTask uploadTask = firebaseStorageRef.putFile(_image);
    var dowurl = await (await uploadTask.onComplete).ref.getDownloadURL();
    setState(() {
      imageURL = dowurl.toString();
  
    });
  </code></pre>
  <p>Hi, Can I ask why the imageURL doesn't change even though I called setState() implicitly.
  I tried printing it out to confirm to see if the image URL inside upload image is changed.
  ImageURL inside upload image is changed but however the global imageURL in publishEvent is unchanged.
  What I am trying to do is to change the image that is being uploaded.</p>
  <p>Can someone with me out?</p>
  <p>Thank you.</p>