title: Flutter Call action function whitout click ussing Mobx
body: <p>I'm trying to call the <code>getdata</code> function from an <code>@action</code> using <code>Mobx</code>. The value is shown on the screen, but when the API is modified the <code>controller.temperature</code> variable is not modified (I called it with a button and it was modified, but I need it to modify without clicking)</p>
  <pre><code>class MyCustomForm extends StatefulWidget {
    @override
    State&lt;MyCustomForm&gt; createState() =&gt; _MyCustomFormState();
  }
  
  class _MyCustomFormState extends State&lt;MyCustomForm&gt; {
    HomeController controller = HomeController();
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          backgroundColor: Colors.white,
          body: Observer(
            builder: (BuildContext context) {
              if (controller.getData() == null) {
                return Center(
                  child: CircularProgressIndicator(),
                );
              } else {
                return Container(
                  padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
                  child: Column(
                    children: &lt;Widget&gt;[
                      Card(
                        elevation: 5,
                        child: InkWell(
                          onTap: () {},
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: &lt;Widget&gt;[
                              Column(
                                mainAxisSize: MainAxisSize.min,
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: &lt;Widget&gt;[
                                  Text(
                                    &quot;sensor date&quot;,
                                    style: TextStyle(
                                        fontSize: 18.0,
                                        fontWeight: FontWeight.bold),
                                  ),
                                  Observer(
                                    builder: (_) {
                                      return Text(
                                        '${controller.temperature}',
                                        style: TextStyle(fontSize: 50.0),
                                      );
                                    },
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                );
              }
            },
          ));
    }
  }
  
  </code></pre>
  <pre><code>abstract class _HomeControllerBase with Store {
  
  
  
    @observable
    String temperature = &quot;&quot;;
  
    @action
    getData() async {
      // here is the code to get api
      temperature = dados ['temperature'] [0] ['value'];
    }
  }
  </code></pre>
  <p>Is there any way for the variable to be modified without clicking?</p>