whenComplete, for an action

Actions & Logic

Is there any simple way to add a "whenComplete" (see https://api.flutter.dev/flutter/dart-async/Future/whenComplete.html) for some final steps to be taken when an action (eventually) completes?

Sure, I can write my own custom Flutter action code to add a "whenComplete" step after a particular action, and I'm doing that for the time being: but it would be nice if FlutterFlow supported "whenComplete" directly, and could generate code for it.

My particular use-case is navigating away from a page, then navigating back to that page, and then needing to reload some state (from a remote API) after the "context.pushNamed(..)" has completed..

The .png screen captures show the issue:

  • first is the UI Editor

  • second is the generated code to implement the "navigate to" action -- which compiles into a "context.pushNamed(...)"

  • third is ideally what is needed: the ability to append a "whenCompleted" to the "context.pushNamed" -- note that this additional code when manually added as I show, is legitimate Dart/Flutter code, and compiles without error...

What have you tried so far?

Searched the FlutterFlow documentation and community

Did you check FlutterFlow's Documentation for this topic?
Yes
2
3 replies