Cannot Get Custom Actions in FF to Actually Update FF App State Variables.

Custom Code

Hi,

I have a custom code where I try to get the background location of an user for every distance filter (say 5 metres) he moves and write the current location of the user to FFAppState - 'currentLocation'. Like a lot of people suggested, I am using the FFAppState.update correctly to the best of my knowledge (attached).

Although there are no errors as such, the actual App State variables have no effect to this change outside the custom code. I reckon updating data to app state only works inside widgets that have a --> context.watch<FFAppState>(). I am not sure.

I still have hope that there is a solution and I am doing it wrong as this seems to be a very general requirement (updating app state from custom actions).

If someone has ever made it work, it'll be great if you can help. Thanks.

FFAppState().update(() {
  FFAppState().currentLocation = currentLocation;
  FFAppState().route.add(currentLocation);
});
What have you tried so far?

All Docs and Community Posts.

Did you check FlutterFlow's Documentation for this topic?
Yes
5
1 reply