reorder method

void reorder(
  1. bool condition(),
  2. void one(),
  3. void two()
)

If condition is true then we call one then two. If condition is false then we call two then one.

Implementation

void reorder(
    bool Function() condition, void Function() one, void Function() two) {
  if (condition()) {
    one();
    two();
  } else {
    two();
    one();
  }
}