asap<T> method Null safety

FutureOr<T> asap<T>(
  1. T computation(
      ),
    1. {bool condition(
        )?}
      )

      Implementation

      FutureOr<T> asap<T>(T computation(), {bool Function()? condition}) async {
        T val;
        if (condition == null || !condition()) {
          await Future.delayed(Duration.zero);
          val = computation();
        } else {
          val = computation();
        }
        return val;
      }